/* ===========================================================
   Deaf Movies Directory
   Palette checked against WCAG 2.1 AA (4.5:1 body, 3:1 large).
   The old site used red (#f00) and orange (#FFAA33) on black,
   plus white on #333 - several of those combinations failed.
   =========================================================== */

:root {
  --ink:        #14161a;
  --ink-soft:   #4a5058;
  --paper:      #ffffff;
  --paper-alt:  #f4f6f8;
  --line:       #d6dbe1;
  --brand:      #10457e;   /* 8.6:1 on white */
  --brand-deep: #0b3159;
  --accent:     #a8410a;   /* 5.4:1 on white - replaces the old #f00 */
  --ok:         #10604a;
  --focus:      #b4530a;
  --radius:     8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:       #eef1f5;
    --ink-soft:  #b3bcc8;
    --paper:     #14171c;
    --paper-alt: #1d2229;
    --line:      #333b46;
    --brand:     #7fb2ee;   /* 7.1:1 on #14171c */
    --brand-deep:#a8ccf5;
    --accent:    #ff9e6b;
    --ok:        #6fd3b2;
    --focus:     #ffb066;
  }
}

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

body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.wrap { width: min(1180px, 92vw); margin-inline: auto; }

/* ---- focus: never remove it, this site must be keyboard usable ---- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff; padding: .75rem 1.25rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* Visible to screen readers, not on screen. Used for table captions
   that would be redundant next to a visible heading. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---- header ---- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper-alt); }
.header-inner {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between; padding: .9rem 0;
}
.brand img { display: block; height: 48px; width: auto; }
.nav-list { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: .55rem .85rem; border-radius: var(--radius);
  color: var(--brand); font-weight: 600; text-decoration: none;
}
.nav-list a:hover { background: var(--paper); text-decoration: underline; }

/* ---- typography ---- */
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.2; margin: 1.5rem 0 .5rem; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); margin: 2rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 .35rem; }
a  { color: var(--brand); }
.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 68ch; }

/* ---- filters ---- */
.filters {
  background: var(--paper-alt); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem; margin: 1.5rem 0;
}
.filter-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
.field input, .field select {
  width: 100%; padding: .55rem .6rem; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper); color: var(--ink);
}
.hint { font-size: .85rem; color: var(--ink-soft); margin: .25rem 0 0; }

.btn {
  display: inline-block; padding: .6rem 1.1rem; font-size: 1rem; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
  text-decoration: none;
}
.btn-primary  { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); }
.btn-secondary { background: var(--paper); color: var(--brand); border-color: var(--line); }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .9rem; }

/* ---- results ---- */
.result-count { font-weight: 600; margin: 1.25rem 0 .5rem; }

.film-grid {
  display: grid; gap: 1.1rem; padding: 0; list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
}
.film-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-alt); padding: 1rem; display: flex; flex-direction: column;
}
.film-card h3 { margin: 0 0 .2rem; font-size: 1.08rem; }
.film-card h3 a { text-decoration: none; }
.film-card h3 a:hover { text-decoration: underline; }
.film-meta { color: var(--ink-soft); font-size: .9rem; margin: 0 0 .5rem; }
.film-synopsis { margin: 0 0 .75rem; font-size: .95rem; }

/* ---- badges: never rely on colour alone, each carries text ---- */
.badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.badge {
  font-size: .78rem; font-weight: 600; padding: .22rem .5rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
}
.badge-lang { border-color: var(--brand); color: var(--brand); }
.badge-deaf-led  { border-color: var(--ok); color: var(--ok); }
.badge-deaf-cast { border-color: var(--brand); color: var(--brand); }
.badge-portrayal { border-color: var(--accent); color: var(--accent); }

/* ---- detail page ---- */
.film-detail { display: grid; gap: 2rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 720px) { .film-detail { grid-template-columns: 1fr; } }

.facts { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.facts th, .facts td {
  text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.facts th { width: 12rem; font-weight: 600; }

.poster { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }

/* ---- pagination ---- */
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 2rem 0; }
.pagination a, .pagination span {
  display: block; padding: .5rem .8rem; border: 1px solid var(--line);
  border-radius: 6px; text-decoration: none;
}
.pagination [aria-current="page"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- messages ---- */
.notice { padding: .9rem 1.1rem; border-radius: var(--radius); border: 1px solid; margin: 1.25rem 0; }
.notice-ok    { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.notice-error { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---- footer ---- */
.site-footer {
  margin-top: 3.5rem; padding: 2rem 0; border-top: 1px solid var(--line);
  background: var(--paper-alt); color: var(--ink-soft); font-size: .92rem;
}
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-note { max-width: 60ch; }

/* ---- forms ---- */
.form-stack { display: grid; gap: 1rem; max-width: 44rem; }
textarea { min-height: 8rem; resize: vertical; font-family: inherit; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.required { color: var(--accent); font-weight: 700; }

/* ---- admin ---- */
.admin-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.admin-table th, .admin-table td {
  padding: .55rem .5rem; border-bottom: 1px solid var(--line); text-align: left;
}
.admin-table thead th { background: var(--paper-alt); }
.table-scroll { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
