/* ============================================================
   Forma — Autumn Index
   A dark editorial program for in-person workshops.
   Ink ground, chartreuse signal, condensed display, mono labels.
   ============================================================ */

:root {
  --ink:        #0c0d0f;
  --ink-2:      #131418;
  --ink-3:      #191b20;
  --line:       #2a2d34;
  --line-soft:  #202227;
  --text:       #eceae3;
  --muted:      #a2a4ab;
  --muted-2:    #8a8c92;
  --accent:     #c7f23e;
  --accent-2:   #a9d92a;
  --accent-dim: rgba(199, 242, 62, 0.14);
  --accent-ink: #0c0d0f;

  --display: "Big Shoulders Display", "Arial Narrow", system-ui, sans-serif;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1280px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--accent);
}
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
ol, ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---- scrollbar (themed) ---- */
* { scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ---- focus ---- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 2px;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.mono {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(12, 13, 15, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: 0.01em;
  line-height: 1;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 3px;
  font-size: 1.25rem;
}
.brand-name { color: var(--text); }
.topbar-meta {
  margin: 0 auto 0 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
@media (max-width: 720px) { .topbar-meta { display: none; } }

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease);
}
.saved-toggle:hover { border-color: var(--muted-2); }
.saved-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted-2);
  transition: background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.saved-toggle .saved-count {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-left: 2px;
}
.saved-toggle[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.saved-toggle[aria-pressed="true"] .dot { background: var(--accent-ink); box-shadow: none; }
.saved-toggle[aria-pressed="true"] .saved-count { color: var(--accent-ink); }

/* ============================================================
   Page shell
   ============================================================ */
.page { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ---- Masthead ---- */
.masthead {
  padding: clamp(36px, 6vh, 64px) 0 clamp(28px, 4vh, 40px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: stretch;
}
.masthead-text { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.masthead-title {
  margin: 0 0 22px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.6rem, 9vw, 7.6rem);
  line-height: 0.86;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.masthead-title .line { display: block; }
.masthead-title .accent { color: var(--accent); }
.masthead-intro {
  max-width: 44ch;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: clamp(15px, 1.1vw, 17px);
  line-height: 1.65;
}
.masthead-stats {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.masthead-stats .accent { color: var(--accent); }

.masthead-figure {
  position: relative;
  margin: 0;
  min-height: clamp(250px, 42vh, 380px);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: var(--ink-2);
}
.masthead-figure::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  z-index: 2;
}
.masthead-figure img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.05);
}
.masthead-figure::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,13,15,0) 40%, rgba(12,13,15,0.78) 100%);
  pointer-events: none;
}
.figure-caption {
  position: absolute;
  left: 16px; bottom: 14px;
  z-index: 2;
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ============================================================
   Controls
   ============================================================ */
.controls {
  position: sticky;
  top: 59px;
  z-index: 30;
  margin: 0 calc(-1 * var(--gutter));
  padding: 16px var(--gutter);
  background: rgba(12, 13, 15, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  grid-template-areas: "search filter results";
  align-items: end;
  gap: 18px 28px;
}
@media (max-width: 720px) {
  .controls { grid-template-columns: 1fr; grid-template-areas: "search" "filter" "results"; }
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-search { grid-area: search; }
.field-filter { grid-area: filter; }
.results { grid-area: results; align-self: center; text-align: right; }
.field-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.search-input {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  width: 18px; height: 18px;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}
.search-input input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.search-input input::placeholder { color: var(--muted-2); }
.search-input input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-input input:focus { border-color: var(--accent); }

.select-wrap { position: relative; display: flex; }
.select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 12px 40px 12px 14px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease);
}
.select-wrap select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.select-wrap select:focus { border-color: var(--accent); }
.select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.results {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.results strong { color: var(--text); font-weight: 600; }

/* ============================================================
   Index list
   ============================================================ */
.list-section { padding: clamp(20px, 3vh, 32px) 0 8px; }
.index-list { display: flex; flex-direction: column; }

.item {
  position: relative;
  display: grid;
  grid-template-columns: 4.25rem 9rem 1fr auto;
  gap: clamp(16px, 2.4vw, 30px);
  align-items: center;
  padding: 22px 4px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.item:first-child { border-top: none; }
.item:hover { background: linear-gradient(90deg, var(--ink-2), transparent 70%); }

.item-index {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 4vw, 3.1rem);
  line-height: 1;
  color: var(--muted-2);
  letter-spacing: 0;
  transition: color 0.2s var(--ease);
  user-select: none;
}
.item:hover .item-index,
.item:focus-within .item-index { color: var(--accent); }

.item-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: var(--ink-2);
}
.item-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.02) brightness(0.92);
  transition: filter 0.3s var(--ease), transform 0.4s var(--ease);
}
.item:hover .item-thumb img { filter: saturate(1.05) contrast(1.05) brightness(1); transform: scale(1.04); }

.item-body { min-width: 0; }
.item-open {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--text);
  transition: color 0.18s var(--ease), transform 0.2s var(--ease);
}
.item:hover .item-open { color: var(--accent); transform: translateX(4px); }
.item-open .arrow {
  display: inline-block;
  margin-left: 0.4em;
  font-family: var(--ui);
  font-size: 0.7em;
  vertical-align: 0.18em;
  transition: transform 0.2s var(--ease);
}
.item:hover .item-open .arrow { transform: translateX(4px); }
.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.item-meta .cat { color: var(--text); }
.item-meta .sep { color: #35383f; }

.item-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  text-align: right;
}
.item-price {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--text);
  white-space: nowrap;
}
.item-price .cur { color: var(--muted-2); font-size: 0.8em; margin-right: 1px; }
.item-saved-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.item.is-saved .item-saved-mark { opacity: 1; transform: none; }
.item-saved-mark svg { width: 12px; height: 12px; fill: var(--accent); }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  padding: clamp(48px, 9vh, 84px) 0;
  text-align: center;
  border-top: 1px solid var(--line-soft);
}
.empty-title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.005em;
  color: var(--text);
}
.empty-body {
  margin: 0 auto 24px;
  max-width: 46ch;
  color: var(--muted);
  font-size: 15px;
}
.empty-recover {
  padding: 11px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.18s var(--ease);
}
.empty-recover:hover { background: var(--accent-2); }

/* ============================================================
   Footer
   ============================================================ */
.page-footer {
  margin-top: clamp(48px, 8vh, 88px);
  padding: 32px 0 48px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.footer-line { margin: 0; color: var(--muted-2); font-size: 13px; }
.footer-line.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }

/* ============================================================
   Detail dialog
   ============================================================ */
.detail {
  margin: 0;
  padding: 0;
  width: 100vw;
  max-width: none;
  max-height: none;
  height: 100vh;
  border: none;
  background: transparent;
  color: var(--text);
}
.detail::backdrop {
  background: rgba(7, 8, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.detail[open] { animation: dialog-in 0.28s var(--ease); }
@keyframes dialog-in { from { opacity: 0; } to { opacity: 1; } }

.detail-panel {
  margin: 0 auto;
  width: min(1080px, 100vw);
  height: 100vh;
  max-height: 100vh;
  background: var(--ink);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
@media (min-width: 880px) {
  .detail { width: min(1080px, 100vw); height: min(92vh, 920px); max-height: 92vh; margin: auto; }
  .detail-panel { height: min(92vh, 920px); border: 1px solid var(--line); border-radius: var(--radius); }
  .detail::backdrop { background: rgba(7,8,10,0.78); }
}

.detail-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(18px, 3vw, 28px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(12,13,15,0.6);
}
.detail-crumb {
  margin: 0 auto 0 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.detail-crumb .accent { color: var(--accent); }
.detail-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.detail-close:hover { border-color: var(--accent); color: var(--accent); }
.detail-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.detail-body {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
}
@media (min-width: 880px) {
  .detail-body { grid-template-columns: 0.95fr 1.05fr; }
}
.detail-media {
  position: relative;
  min-height: 38vh;
  background: var(--ink-2);
  overflow: hidden;
}
@media (min-width: 880px) { .detail-media { min-height: 0; } }
.detail-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(1) contrast(1.04);
}
.detail-media .index-tag {
  position: absolute;
  left: 18px; top: 18px;
  padding: 6px 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  border-radius: 2px;
}

.detail-content {
  padding: clamp(24px, 4vw, 40px) clamp(22px, 4vw, 44px) clamp(28px, 4vw, 44px);
  overflow-y: auto;
}
.detail-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 0.9;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.detail-body-text {
  margin: 0 0 28px;
  max-width: 56ch;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.65;
  color: var(--text);
}
.detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 28px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.fact { background: var(--ink); padding: 14px 16px; }
.fact-label {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.fact-value { font-size: 15px; font-weight: 500; color: var(--text); }
.fact-value.mono { font-family: var(--mono); letter-spacing: 0.02em; }

.save-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px 13px 18px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.save-item:hover { border-color: var(--muted-2); }
.save-item svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.save-item[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.save-item[aria-pressed="true"] svg { fill: var(--accent-ink); stroke: var(--accent-ink); }
.save-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.save-item[aria-pressed="true"]:focus-visible { outline-color: var(--accent-ink); outline-offset: 2px; }

.detail-instructor {
  margin: 0 0 24px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-instructor strong { color: var(--text); font-weight: 600; }

/* ============================================================
   Responsive — list rows on small screens
   ============================================================ */
@media (max-width: 720px) {
  .masthead { grid-template-columns: 1fr; padding-top: 32px; }
  .masthead-figure { min-height: 200px; order: -1; }
  .masthead-text { justify-content: flex-start; }

  .item {
    grid-template-columns: 3rem 1fr auto;
    grid-template-areas:
      "index thumb aside"
      "body  body  body";
    gap: 14px;
    padding: 20px 2px;
  }
  .item-index { grid-area: index; font-size: 2rem; align-self: start; }
  .item-thumb { grid-area: thumb; }
  .item-aside { grid-area: aside; justify-self: end; }
  .item-body { grid-area: body; margin-top: 2px; }
  .item-meta { margin-bottom: 6px; }
  .item-open { font-size: 1.55rem; }

  .detail-topbar { padding: 12px 16px; }
  .detail-content { padding: 24px 18px 32px; }
  .detail-facts { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .item-open { font-size: 1.4rem; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .item:hover .item-thumb img { transform: none; }
  .item:hover .item-open { transform: none; }
  .detail[open] { animation: none; }
}
