/* Cut index components (the cuts app). Built on the tokens and classes of site.css; nothing here
   touches the design system itself. Hairline grids, white frames for the placeholder
   illustrations, small uppercase labels, no rounded corners, no icons. */

/* ------------------------------------------------------------------ filters and counts */
.cut-filters { display: grid; grid-template-columns: 190px 220px minmax(200px, 1fr) auto; gap: 18px; align-items: end; margin-top: 40px; }
.cut-filters .field input, .cut-filters .field select { padding: 12px 14px; }
.cut-filters .field select { appearance: none; -webkit-appearance: none; padding-right: 38px; background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23070807' stroke-width='1.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 14px 14px; }
.cut-filters .field input[type="search"] { -webkit-appearance: none; appearance: none; }
.cut-filter-actions { display: flex; align-items: center; gap: 24px; min-height: 52px; }
.cut-count { margin-top: 24px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }

/* ------------------------------------------------------------------ family cards */
.cut-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(50px, 6vw, 80px); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cut-card { display: flex; flex-direction: column; min-height: 100%; background: var(--paper); color: var(--ink); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background .18s; }
.cut-card:hover { background: #fff; }
.cut-frame { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; padding: 18px 18px 28px; background: #fff; border-bottom: 1px solid var(--line); overflow: hidden; }
/* the handbook extracts are small; scale them to the frame so a card never shows a speck in a white field */
.cut-frame img { width: 72%; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; image-rendering: auto; }
.cut-frame.diagram img { width: auto; height: 100%; }
/* a family without a photograph: the name set in the display face, the same frame as its neighbours */
.cut-frame.empty { background: var(--bone); color: var(--muted); font-size: 22px; line-height: 1.12; letter-spacing: -.03em; text-align: center; }
.cut-frame.large { aspect-ratio: 16 / 9; }
.cut-card-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 22px 22px 24px; }
.cut-kicker { color: var(--oxblood); font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.cut-card h3 { font-size: clamp(19px, 1.6vw, 24px); line-height: 1.12; letter-spacing: -.03em; }
.cut-codes { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.cut-card .text-link { margin-top: auto; padding-top: 16px; }
.cut-grid.light { border-color: var(--line-light); }
.cut-grid.light .cut-card { background: #ffffff08; color: #fff; border-color: var(--line-light); }
.cut-grid.light .cut-card:hover { background: #ffffff14; }
.cut-grid.light .cut-frame { border-color: var(--line-light); }
.cut-grid.light .cut-kicker { color: var(--gold); }
.cut-grid.light .cut-codes { color: var(--white-60); }

/* ------------------------------------------------------------------ carcase diagram */
.carcase-figure { margin: clamp(50px, 6vw, 80px) 0 clamp(50px, 6vw, 80px); }
.carcase-svg { display: block; width: min(100%, 980px); height: auto; margin: 0 auto; }
.carcase-svg .region path { fill: #ffffff0f; stroke: #ffffff5c; stroke-width: 1.2; transition: fill .18s; }
.carcase-svg .region.hq path { fill: #ffffff2b; }
.carcase-svg a.region:hover path, .carcase-svg a.region:focus path { fill: #ffffff52; }
.carcase-svg a.region:focus { outline: none; }
.carcase-svg a.region:focus-visible path { stroke: var(--gold); stroke-width: 2.5; }
.carcase-svg .region text { fill: #ffffffd9; font-family: var(--font); font-size: 15px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; text-anchor: middle; pointer-events: none; }
.carcase-svg .outline { fill: none; stroke: #ffffffb3; stroke-width: 2.2; stroke-linejoin: round; }
.carcase-svg .divide { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 7 7; }
.carcase-legend { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 20px; color: var(--white-70); font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.carcase-legend i { display: inline-block; width: 22px; height: 12px; margin-right: 9px; vertical-align: middle; border: 1px solid #ffffff5c; background: #ffffff0f; }
.carcase-legend i.hq { background: #ffffff2b; }
.carcase-figure figcaption { max-width: 720px; margin-top: 14px; color: var(--white-60); font-size: 12px; line-height: 1.6; letter-spacing: .02em; }

/* family lists beside the diagram */
.cut-list-card { min-height: 0; }
.cut-list-card h3 { margin: 26px 0 20px; }
.cut-list { width: 100%; margin: 0; padding: 0; list-style: none; }
.cut-list li { border-top: 1px solid var(--line-light); }
.cut-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; color: #fff; font-size: 14px; letter-spacing: -.01em; transition: color .16s; }
.cut-list a:hover { color: var(--gold); }
.cut-list svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4px; opacity: .6; }

/* ------------------------------------------------------------------ figures (family and reference pages) */
.cut-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.cut-figure { margin: 0; }
.cut-figure .cut-frame { aspect-ratio: 1; padding: 22px; border: 1px solid var(--line); }
.cut-figure figcaption { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.6; letter-spacing: .03em; }
.cut-figure figcaption .status { display: inline-block; margin: 0 8px 0 0; padding: 2px 8px; border: 1px dashed #7c2e4366; color: var(--oxblood); font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; vertical-align: middle; }
.cut-attribution { max-width: 560px; margin-top: 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.cut-attribution.light { color: var(--white-60); }
.cut-forms thead th { width: auto; }
.cut-forms tbody th { color: var(--ink); font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* ------------------------------------------------------------------ reference index */
.ref-search { grid-template-columns: minmax(200px, 440px) auto; }
.ref-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.ref-nav a, .cut-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border: 1px solid var(--line); color: var(--muted-dark); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; transition: color .16s, border-color .16s; }
.ref-nav a:hover, .cut-chip:hover { color: var(--oxblood); border-color: #7c2e4366; }
.ref-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: clamp(40px, 5vw, 64px); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.ref-entry { display: grid; grid-template-columns: 96px 1fr; gap: 22px; padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ref-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; padding: 8px; background: #fff; border: 1px solid var(--line); }
.ref-thumb img { width: 88%; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.ref-thumb-empty { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.ref-code { display: block; color: var(--oxblood); font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.ref-entry h3 { margin: 8px 0 6px; font-size: 20px; line-height: 1.15; letter-spacing: -.02em; }
.ref-entry h3 a:hover { color: var(--oxblood); }
.ref-aliases { color: var(--muted); font-size: 13px; }
.ref-variants { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.cut-chip { min-height: 26px; padding: 0 9px; font-size: 8px; }
.hair-card .ref-variants { margin: 0 0 24px; }
.hair-grid.light .cut-chip { border-color: var(--line-light); color: var(--white-70); }
.hair-grid.light .cut-chip:hover { color: var(--gold); border-color: var(--gold); }
/* the reference-code grid takes as many columns as there are codes (cols-1 and cols-2 come from the template) */
.cut-ref-grid.cols-1 { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
.cut-ref-card { min-height: 300px; }
.cut-ref-card h3 { margin-top: 30px; }
.cut-rel-card { min-height: 240px; }
.cut-rel-card h3 { margin: 26px 0 16px; }
.cut-rel-card ul { width: 100%; margin: 0; padding: 0; list-style: none; }
.cut-rel-card li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.45; }
.cut-rel-card li a { color: var(--oxblood); }
.cut-rel-card li a:hover { color: var(--ink); }
.cut-links { display: flex; flex-wrap: wrap; gap: 34px; margin-top: 52px; }
.section-ink .notice, .section-ink-soft .notice { color: var(--white-70); border-color: #ffffff40; background: #ffffff0a; }

/* ------------------------------------------------------------------ English content on /ar/ pages */
/* blocks marked lang="en" dir="ltr" by {% english_attrs %} keep their reading direction; the arrows
   inside them are not mirrored */
[dir="rtl"] [dir="ltr"] { text-align: left; }
[dir="rtl"] [dir="ltr"] .text-link svg, [dir="rtl"] .cut-list[dir="ltr"] svg, [dir="rtl"] .record-grid[dir="ltr"] svg { transform: none; }
[dir="rtl"] .record-grid[dir="ltr"] > a { border-left: 0; border-right: 1px solid var(--line); }
[dir="rtl"] .record-grid[dir="ltr"] > a:nth-child(2n) { border-right: 0; }

/* ------------------------------------------------------------------ responsive */
@media (width <= 1220px) {
  .cut-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cut-filters { grid-template-columns: 1fr 1fr; }
  .ref-grid { grid-template-columns: 1fr; }
}
@media (width <= 760px) {
  .cut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cut-card-body { padding: 16px 16px 18px; }
  .cut-card h3 { font-size: 17px; }
  .cut-filters, .ref-search { grid-template-columns: 1fr; }
  .cut-figures { grid-template-columns: 1fr 1fr; }
  .carcase-svg .region text { display: none; }
  .carcase-figure figcaption { font-size: 11px; }
}
@media (width <= 580px) {
  .cut-forms thead { display: none; }
}
@media (width <= 420px) {
  .cut-figures { grid-template-columns: 1fr; }
  .ref-entry { grid-template-columns: 72px 1fr; gap: 14px; padding: 16px; }
  .ref-entry h3 { font-size: 18px; }
}
