@font-face {
  font-family: Inter;
  src: url('../fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
}

:root {
  --ink: #f5f0e8;
  --dark-ink: #202227;
  --muted: #a4a19b;
  --link-decoration: #73766d;
  --bg: #111316;
  --header-bg: #11120fe8;
  --panel: #000;
  --line: #2d3645;
  --accent: #3fb0f4;
  --accent-gradient: linear-gradient(21deg, rgba(7, 106, 168, 1) 0%, rgba(13, 123, 191, 1) 15%, rgba(120, 197, 245, 1) 100%);
  --danger: #ff8a78;
  --danger-bg: #411a14;
  --radius: 18px;
  --highlight-color: #2d4254;
  --button-bg: #24282a;
  --button-hover-bg: #121516;
  --comment-bg: rgba(255, 255, 255, 0.788);
  --comment-mine-bg: rgba(182, 218, 240, 0.788);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 70% -10%, var(--highlight-color) 0, transparent 40rem), var(--bg);
}

a {
  color: inherit;
  text-decoration-color: var(--link-decoration);
  text-underline-offset: 4px;

  i {
    font-size: .8rem;
    margin-left: 3px;
  }
}

.site-header {
  height: 72px;
  padding: 0 max(5vw, 1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  z-index: 5;
}

.brand {
  font-weight: 850;
  letter-spacing: -.04em;
  text-decoration: none;
  font-size: 1.3rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;

  img.logo {
    height: 3.5rem;
  }
}

.site-header nav {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  font-size: .9rem
}

.inline {
  display: inline
}

main {
  width: min(1200px, 90vw);
  margin: 0 auto;
  padding: 3rem 0 6rem
}

footer {
  text-align: center;
  border-top: 1px solid var(--line);
  padding: 2rem;
  color: var(--muted);
  font-size: .85rem
}

.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem
}

.refresh-dialog {
  width: min(34rem, calc(100vw - 2rem));
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius)
}

.refresh-dialog::backdrop {
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(4px)
}

.refresh-dialog-content {
  padding: clamp(1.5rem, 5vw, 2.5rem);
  text-align: left
}

.refresh-dialog-content h2 {
  margin-top: 0
}

.refresh-dialog-content p {
  line-height: 1.55
}

.refresh-progress {
  color: var(--muted)
}

.refresh-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem
}

.media-details-dialog {
  max-width: 900px;
  margin: 20px auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg);
  color: var(--ink)
}

.media-details-dialog::backdrop {
  background: rgba(0, 0, 0, .85)
}

.media-details-loading {
  /* min-height: 100dvh; */
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center
}

.media-details-error-actions,
.media-details-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap
}

.media-details {
  /* min-height: 100dvh; */
  display: grid;
  grid-template-areas: "visual" "heading" "ratings" "overview" "actions";
  gap: clamp(1.25rem, 3vw, 2.5rem);
  /* width: min(1100px, 92vw); */
  margin: 0 auto;
  /* padding: clamp(1.25rem, 4vw, 3rem) 0 */
}

.media-details-heading {
  grid-area: heading
}

.media-details-visual {
  grid-area: visual
}

.media-details-ratings {
  grid-area: ratings
}

.media-details-overview {
  grid-area: overview
}

.media-details-actions {
  grid-area: actions
}

.media-details-heading h2 {
  margin: .2rem 0 1.25rem;
  font-size: clamp(2rem, 6vw, 4rem)
}

.media-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 2rem;
  margin: 0
}

.media-facts div {
  min-width: 8rem
}

.media-facts dt {
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em
}

.media-facts dd {
  margin: .25rem 0 0
}

.media-details-visual {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  /* min-height: min(62vh, 650px) */
}

.media-details-poster {
  width: 100%;
  /* height: min(62vh, 650px); */
  object-fit: contain;
  object-position: center;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.media-details-comments {
  min-height: 0;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden
}

.media-details-comments h3,
.media-details-ratings h3,
.media-details-overview h3 {
  margin-top: 0
}

.details-comment-list {
  display: grid;
  align-content: start;
  gap: .8rem;
  max-height: calc(min(62vh, 650px) - 5rem);
  overflow-y: auto;
  padding: .4rem .5rem .8rem 0
}

@media (max-width: 700px) {
  .media-details {
    grid-template-areas: "heading" "visual" "ratings" "overview" "actions"
  }

  .media-details-visual {
    grid-template-columns: 1fr;
    min-height: 0
  }

  .media-details-poster {
    height: auto;
    max-height: 50vh;
    width: unset;
    max-width: 100%;
    margin: 0 auto;
  }

  .details-comment-list {
    max-height: none;
    overflow: visible
  }
}

button:disabled {
  cursor: wait;
  opacity: .65
}

.hero {
  display: block;
  margin-bottom: 2.5rem
}

.hero-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1.5rem
}

.turn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem
}

.turn-card {
  min-height: 290px;
  perspective: 1200px;
  border-radius: var(--radius)
}

.turn-card-inner {
  position: relative;
  min-height: inherit;
  transform-style: preserve-3d;
  transition: transform .65s cubic-bezier(.2, .75, .25, 1)
}

.turn-card.is-flipped .turn-card-inner {
  transform: rotateY(180deg)
}

.turn-card.is-reshuffling .turn-card-inner {
  animation: turn-card-reshuffle .65s cubic-bezier(.2, .75, .25, 1)
}

.turn-card-face {
  position: absolute;
  inset: 0;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  backface-visibility: hidden
}

.turn-card-front {
  background: linear-gradient(145deg, var(--highlight-color), var(--panel) 65%)
}

.turn-card-back {
  transform: rotateY(180deg);
  background-color: var(--panel);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff
}

.turn-card-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(10, 10, 8, .22), rgba(10, 10, 8, .9));
  pointer-events: none
}

.turn-suggestion-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start
}

.turn-suggestion-content .eyebrow {
  margin-bottom: auto
}

.turn-suggestion-status,
.turn-suggestion-year {
  margin: .35rem 0;
  color: rgba(255, 255, 255, .82)
}

.turn-suggestion-title {
  margin: 0;
  color: #fff;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  line-height: .95
}

.turn-suggestion-link {
  margin-top: 1rem;
  color: #fff;
  border-color: rgba(255, 255, 255, .7);
  background: rgba(10, 10, 8, .65)
}

.turn-card-interactive {
  cursor: pointer
}

.turn-card-interactive:hover .turn-card-face,
.turn-card-interactive:focus-visible .turn-card-face {
  border-color: var(--accent)
}

.turn-card-interactive:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px
}

.turn-card[aria-busy="true"] {
  cursor: progress
}

@keyframes turn-card-reshuffle {
  from {
    transform: rotateY(180deg)
  }

  to {
    transform: rotateY(540deg)
  }
}

.turn-name {
  margin: auto 0;
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  line-height: .9;
  letter-spacing: -.06em;
  font-weight: 850
}

.turn-context {
  margin: 1.5rem 0 0;
  color: var(--muted)
}

.turn-context strong {
  color: var(--ink)
}

.hero h1,
.form-shell h1,
.auth-card h1 {
  font-size: clamp(2.3rem, 6vw, 5.5rem);
  line-height: .95;
  letter-spacing: -.06em;
  margin: .2rem 0
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .7rem;
  font-weight: 800;
  color: var(--accent);
}

.hero-actions,
.actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.hero-actions {
  margin-top: 3rem;
  font-size: 1.3em;
  justify-content: flex-end;
}

.button,
button {
  border: 1px solid var(--line);
  background: var(--button-bg);
  color: var(--ink);
  border-radius: 999px;
  padding: .7rem 1rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s ease-in-out, color .2s ease-in-out;

  &:not(.primary):hover {
    background: var(--button-hover-bg);
  }
}

.primary {
  background: var(--accent);
  background: var(--accent-gradient);
  color: var(--dark-ink);
  border-color: var(--ink);
  font-weight: 750;

}

.link-button {
  background: none;
  border: solid 1px var(--line);
  border-radius: 999px;
  padding: .7rem 1rem;
  text-decoration: none;
  text-underline-offset: 4px
}

.danger {
  color: var(--danger)
}

.link-button.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--ink)
}

.filters {
  display: flex;
  gap: .7rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
  background: #161713
}

.filters select,
.filters button {
  width: auto
}

.section-heading {
  display: flex;
  align-items: center;
  gap: .7rem;
  border-bottom: 1px solid var(--line);
  margin: 3rem 0 1.2rem
}

.section-heading h2 {
  font-size: 1.6rem
}

.section-heading span {
  color: var(--muted)
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1.1fr));
  gap: 1.1rem
}

.media-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: var(--highlight-color);
}

.poster-wrap {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
}

.poster-wrap .poster {
  display: block;
  height: 100%;
}

.poster-comments {
  position: absolute;
  inset: auto .7rem .7rem;
  display: grid;
  gap: .5rem;
  max-height: calc(100%);
  scrollbar-width: thin;
  filter: drop-shadow(0 .25rem .5rem rgba(0, 0, 0, .55));
}

.comment-bubble {
  position: relative;
  margin: 0;
  padding: .65rem .8rem;
  border-radius: 14px 14px 14px 0;
  background: var(--comment-bg);
  color: var(--dark-ink);
  font-size: .82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;

  &.mine {
    border-radius: 14px 14px 0 14px;
    background: var(--comment-mine-bg);
    color: var(--dark-ink);
  }
}

.comment-bubble::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -.35rem;
  border-width: .4rem .45rem 0 0;
  border-style: solid;
  border-color: var(--comment-bg) transparent transparent transparent;
}

.comment-bubble.mine::after {
  left: unset;
  right: 0;
  border-width: .4rem 0 0 .45rem;
  border-color: var(--comment-mine-bg) transparent transparent transparent;
}

.legacy-note {
  color: var(--muted);
  font-size: .86rem
}

.card-body {
  padding: 1rem
}

.card-body h3 {
  font-size: 1.35rem;
  margin: .25rem 0
}

.card-body p {
  line-height: 1.5
}

.muted,
.ratings {
  color: var(--muted);
  font-size: .86rem
}

.ratings {
  display: flex;
  flex-direction: column;
  color: #eedb69
}

.empty {
  padding: 2rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius)
}

.form-shell,
.auth-card {
  max-width: 650px;
  margin: 2rem auto;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: clamp(1.3rem, 5vw, 3.5rem);
  border-radius: var(--radius)
}

.auth-card {
  max-width: 500px
}

.stack {
  display: grid;
  gap: 1.2rem;
  margin-top: 2rem
}

label {
  display: grid;
  gap: .45rem;
  font-size: .82rem;
  color: var(--muted)
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #486b73;
  background: #121518;
  color: var(--ink);
  border-radius: 10px;
  padding: .85rem;
  font: inherit
}

textarea {
  resize: vertical
}

.check {
  display: flex;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center
}

.check input {
  width: auto
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: .8rem
}

legend {
  color: var(--ink);
  padding: 0 .4rem
}

.search-wrap {
  position: relative
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #242620;
  border: 1px solid var(--line);
  z-index: 4;
  box-shadow: 0 15px 40px #0008
}

.search-result {
  width: 100%;
  border: 0;
  border-radius: 0;
  display: flex;
  gap: .7rem;
  text-align: left;
  align-items: center
}

.search-result:hover {
  background: #34372e
}

.search-result img {
  width: 38px;
  height: 57px;
  object-fit: cover
}

.search-result span {
  display: grid
}

.search-result small {
  color: var(--muted)
}

.search-message {
  padding: .8rem;
  margin: 0
}

.selected-media {
  padding: .8rem;
  border-left: 3px solid var(--accent);
  background: #25281b
}

.flash {
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  background: #283020
}

.flash.error {
  background: #48251f
}

.flash.warning {
  background: #463d1c
}

.archive-list {
  display: grid;
  gap: .6rem
}

.archive-list>div {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--line)
}

.tmdb-credit {
  margin: 2rem 0
}

.tmdb-mark {
  font-weight: 950;
  font-size: 2rem;
  letter-spacing: .2em;
  color: #01b4e4
}

.tmdb-credit img {
  width: min(220px, 70%);
  height: auto
}

@media(max-width:700px) {
  .site-header {
    height: auto;
    /* padding-block: 1rem; */
    align-items: center;
  }

  .site-header nav {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .7rem
  }

  .hero {
    display: block
  }

  .hero-heading {
    display: block
  }

  .turn-grid {
    grid-template-columns: 1fr
  }

  .turn-card {
    min-height: 236px
  }

  .filters>* {
    flex: 1
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .card-body {
    padding: .75rem
  }

  .card-body h3 {
    font-size: 1.05rem
  }

  .actions {
    font-size: .8rem
  }

  .archive-list>div {
    grid-template-columns: 1fr auto
  }

  .archive-list span {
    display: none
  }
}

@media (prefers-reduced-motion: reduce) {
  .turn-card-inner {
    transition: none
  }

  .turn-card.is-reshuffling .turn-card-inner {
    animation: none
  }
}