/* Design tokens — Alejandro Rosales Rodriguez */
:root {
  --bg: #FAF9F5;
  --ink: #141413;
  --muted: #87867F;
  --clay: #D97757;

  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --font-sans: Outfit, system-ui, -apple-system, sans-serif;

  --nav-h: 3.25rem;
  --pad-x: clamp(1.25rem, 4vw, 2.5rem);
  --radius-poster: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--ink);
}

img {
  max-width: 100%;
  display: block;
}

/* ——— Thin nav ——— */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--nav-h);
  padding: 0 var(--pad-x);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-mark {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2.5vw, 1.5rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a.is-active {
  color: var(--ink);
}

/* ——— Page shells ——— */
.page {
  padding: 0 var(--pad-x) 4rem;
}

.page--home,
.page--stub {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--nav-h));
  justify-content: center;
  padding-bottom: 6rem;
}

.quiet-line {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--muted);
  margin: 0;
  max-width: 28ch;
}

.quiet-line a {
  color: var(--ink);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  transition: border-color 0.2s var(--ease);
}

.quiet-line a:hover {
  border-bottom-color: var(--ink);
}

.quiet-empty {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
  letter-spacing: 0.02em;
}

/* ——— Movies: no H1, headerless ——— */
.page--movies,
.page--watchlist,
.page--watched {
  padding-top: 1.5rem;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(0.75rem, 2vw, 1.25rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 720px) {
  .poster-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.poster-card {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.poster-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-poster);
  overflow: hidden;
  border: 0;
  outline: none;
  box-shadow: none;
  background: color-mix(in srgb, var(--muted) 18%, var(--bg));
  transform: scale(1);
  /* Release / settle — Apple ease-out */
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
  .poster-card:hover .poster-frame {
    transform: scale(1.015);
    transition-duration: 240ms;
  }
}

.poster-card:focus-visible {
  outline: none;
}

.poster-card:focus-visible .poster-frame {
  transform: scale(1.015);
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

/* Press overrides hover — snappy in, no filter/shadow */
.poster-card.is-pressed .poster-frame,
.poster-card.is-pressed:hover .poster-frame,
.poster-card:active .poster-frame {
  transform: scale(0.97);
  transition-duration: 80ms;
  transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* While modal is open: freeze all poster sizes — no hover/press jump under the dim */
body.modal-open .poster-card .poster-frame,
body.modal-open .poster-card:hover .poster-frame,
body.modal-open .poster-card:active .poster-frame,
body.modal-open .poster-card.is-pressed .poster-frame,
body.modal-open .poster-card:focus-visible .poster-frame,
body.modal-open .reading-card .reading-cover,
body.modal-open .reading-card:hover .reading-cover,
body.modal-open .reading-card:active .reading-cover,
body.modal-open .reading-card.is-pressed .reading-cover,
body.modal-open .reading-card:focus-visible .reading-cover {
  transform: scale(1);
  transition: none;
}


.poster-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  display: block;
}

/* Gradient placeholder when poster fails / missing */
.poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--muted) 35%, var(--bg)),
    color-mix(in srgb, var(--ink) 55%, var(--muted))
  );
}

.poster-placeholder::after {
  content: attr(data-title);
  font-family: var(--font-serif);
  font-size: clamp(0.75rem, 1.8vw, 0.95rem);
  font-weight: 600;
  color: var(--bg);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* ——— Detail modal ——— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease);
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 35%, transparent);
  border: 0;
  cursor: pointer;
  padding: 0;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 22rem);
  background: var(--bg);
  border-radius: 14px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 24px 64px color-mix(in srgb, var(--ink) 20%, transparent);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.3s var(--ease);
}

.modal.is-open .modal-panel {
  transform: none;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.modal-year {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 1rem;
}

.modal-note {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--ink);
  margin: 0;
  line-height: 1.55;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.modal-close:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--muted) 15%, transparent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.movies-status {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--muted);
  margin: 2rem 0 0;
}

body.modal-open {
  overflow: hidden;
}

/* ——— Filter row + expand-left search (Designer) ——— */
.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 1rem;
  row-gap: 0.65rem;
  padding: 0.75rem 0 1.25rem;
}

.filter-row__cats,
.watch-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  min-width: 0;
  padding: 0;
  margin: 0;
}

.watch-filter button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 28px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.watch-filter button:hover {
  color: var(--ink);
}

.watch-filter button.is-active {
  color: var(--ink);
}

.watch-filter button:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
  border-radius: 2px;
}

.search {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-self: end;
  align-self: start;
  height: 28px;
  width: max-content;
  max-width: min(320px, 70vw);
  position: relative;
  z-index: 2;
}

.search__toggle {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  opacity: 0.55;
  cursor: pointer;
  line-height: 0;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.search__toggle:hover,
.search[data-open="true"] .search__toggle {
  opacity: 1;
  color: var(--ink);
}

.search__toggle:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
  border-radius: 2px;
}

.search__toggle svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.search__field {
  display: grid;
  grid-template-columns: 0fr;
  transition: grid-template-columns 220ms var(--ease);
  overflow: hidden;
}

.search[data-open="true"] .search__field {
  grid-template-columns: 1fr;
}

.search[data-open="false"] .search__field {
  pointer-events: none;
}

.search__field-inner {
  min-width: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
}

.search__input {
  width: clamp(160px, 28vw, 260px);
  max-width: 100%;
  height: 32px;
  box-sizing: border-box;
  margin: 0 4px 0 0;
  padding: 0 28px 0 8px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search__input::-webkit-search-decoration,
.search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.search__input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search__input:focus {
  border-bottom-color: color-mix(in srgb, var(--ink) 45%, transparent);
}

.search__clear {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.search__clear:hover {
  color: var(--ink);
}


/* ——— Favorite Movies statement ——— */
.page--favorites .favorites-statement-wrap {
  width: 100%;
  margin: 0 0 2rem;
  overflow: visible;
}

.page--favorites .favorites-statement-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.page--favorites .favorites-statement-svg text {
  fill: var(--ink);
}

/* ——— Reading ——— */
.page--reading {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.reading-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.reading-grid > li {
  min-width: 0;
  max-width: 100%;
}

.reading-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.reading-card:hover {
  color: inherit;
}

.reading-card:focus-visible {
  outline: none;
}

.reading-card:focus-visible .reading-cover {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

.reading-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--muted) 18%, var(--bg));
  transform: scale(1);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
  .reading-card:hover .reading-cover {
    transform: scale(1.015);
    transition-duration: 240ms;
  }
}

.reading-card.is-pressed .reading-cover,
.reading-card.is-pressed:hover .reading-cover,
.reading-card:active .reading-cover {
  transform: scale(0.97);
  transition-duration: 80ms;
  transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

.reading-cover img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  border: 0;
}

.reading-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.reading-title {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reading-author,
.reading-date {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 720px) {
  .reading-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.125rem;
  }
}

@media (min-width: 1100px) {
  .reading-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.25rem;
  }
}
