/* ============================================================
   Forma - dark editorial atelier catalog
   Theme lock: dark. One accent (terracotta on slate). Sharp corners.
   Display: system serif. Body/UI: system sans.
   ============================================================ */

:root {
  --bg: #14161a;
  --bg-2: #181b20;
  --surface: #1e222a;
  --surface-2: #262b34;
  --text: #f3f0ea;
  --text-2: #cdd2da;
  --muted: #8b929d;
  --faint: #717880;
  --line: rgba(243, 240, 234, 0.12);
  --line-2: rgba(243, 240, 234, 0.22);
  --accent: #d9663a;
  --accent-2: #e8845a;
  --accent-soft: rgba(217, 102, 58, 0.16);
  --on-accent: #1c0f08;

  --serif: "Iowan Old Style", "Palatino Linotype", "Palatino", "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", "Consolas", monospace;

  --maxw: 1180px;
  --gut: clamp(1.25rem, 4vw, 3rem);
  --rad: 0px;            /* sharp corners everywhere, one system */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

/* faint vertical accent rail on wide screens, motivated: ties masthead to index */
body::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 38%);
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}
@media (max-width: 760px) { body::before { display: none; } }

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

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

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-weight: 600;
  z-index: 100;
}
.skip:focus { left: 0.75rem; top: 0.75rem; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
@media (prefers-reduced-transparency: reduce) {
  .masthead { background: var(--bg); }
}
.masthead__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gut);
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
}
.wordmark__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  font-style: italic;
  letter-spacing: -0.02em;
}
.wordmark__name {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.masthead__meta {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 13px;
}
.masthead__stat, .masthead__saved {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--muted);
}
.masthead__stat-n, .masthead__saved-n {
  font-family: var(--mono);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}
.masthead__saved-n { color: var(--accent-2); }
.masthead__divider {
  width: 1px;
  height: 16px;
  background: var(--line-2);
}

/* ---------- Intro (hero) ---------- */
.intro {
  padding: clamp(3rem, 9vw, 5.5rem) 0 clamp(2.5rem, 6vw, 3.5rem);
}
.intro__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gut);
}
.intro__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 1.1rem;
  max-width: 18ch;
}
.intro__lede {
  margin: 0;
  max-width: 52ch;
  color: var(--text-2);
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  line-height: 1.65;
}

/* ---------- Browse / tools ---------- */
.browse {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gut) 4rem;
}
.browse__title {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1.1rem 1.4rem;
  padding: 1.1rem 0 1.4rem;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field--search { flex: 1 1 320px; min-width: 240px; }
.field--select { flex: 0 0 auto; }
.field--saved { flex: 0 0 auto; justify-content: flex-end; }
.field__label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.field__control {
  position: relative;
  display: flex;
  align-items: center;
}
.field__icon {
  position: absolute;
  left: 0.8rem;
  width: 18px; height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.field__control input,
.field__control select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 0.9rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.field__control input { padding-left: 2.4rem; }
.field__control input::placeholder { color: var(--muted); }
.field__control input:focus,
.field__control select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.field__control select { padding-right: 2.4rem; cursor: pointer; }
.field__chevron {
  position: absolute;
  right: 0.7rem;
  width: 18px; height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.tools__count {
  margin: 0 0 0 auto;
  align-self: end;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding-bottom: 0.2rem;
}

/* saved filter chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.62rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.1s var(--ease);
}
.chip__dot {
  width: 8px; height: 8px;
  background: var(--faint);
  transition: background 0.2s var(--ease);
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: translateY(1px); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 600;
}
.chip[aria-pressed="true"] .chip__dot { background: var(--on-accent); }

/* ---------- Index (table-of-contents) ---------- */
.index--ready .work { animation: none; opacity: 1; transform: none; }
.index {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: row;
}
.work {
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.6s var(--ease) forwards;
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}
.work__open {
  display: grid;
  grid-template-columns: 2.4rem 6rem minmax(0, 1fr) 13rem 5.5rem 5.5rem;
  align-items: center;
  gap: 1.5rem;
  padding: 1.35rem 0.6rem 1.35rem 0.25rem;
  color: inherit;
  transition: background 0.25s var(--ease);
  position: relative;
}
.work__open::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.work__open:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.work__open:hover::after { transform: scaleX(1); }
.work__open:focus-visible { outline-offset: -2px; }

.work__no {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.04em;
}
.work__thumb {
  display: block;
  width: 6rem;
  height: 4.4rem;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}
.work__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.02);
  transition: transform 0.5s var(--ease), filter 0.4s var(--ease);
}
.work__open:hover .work__thumb img {
  transform: scale(1.06);
  filter: saturate(1.05) contrast(1.05);
}
.work__title {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.1vw, 1.85rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 0.45rem;
}
.work__sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid var(--line-2);
  padding: 0.18rem 0.5rem;
}
.work__date {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.5;
}
.work__date strong { display: block; font-weight: 600; color: var(--text); }
.work__price {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  text-align: right;
  color: var(--text);
  letter-spacing: -0.01em;
}
.work__price small { font-family: var(--sans); font-size: 0.7rem; color: var(--muted); display: block; font-weight: 400; letter-spacing: 0.04em; }
.work__view {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  text-align: right;
  text-transform: uppercase;
  transition: letter-spacing 0.25s var(--ease), color 0.25s var(--ease);
}
.work__open:hover .work__view { letter-spacing: 0.12em; color: var(--text); }

.work[data-saved="true"] .work__no { color: var(--accent); }
.work[data-saved="true"]::before {
  content: "";
}

/* saved marker: small accent block on the left of saved rows */
.work__saveflag {
  position: absolute;
  left: -0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent);
  transition: height 0.3s var(--ease);
}
.work[data-saved="true"] .work__saveflag { height: 62%; }

/* ---------- Skeleton loading ---------- */
.skel {
  display: grid;
  grid-template-columns: 2.4rem 6rem minmax(0, 1fr) 13rem 5.5rem 5.5rem;
  align-items: center;
  gap: 1.5rem;
  padding: 1.35rem 0.6rem 1.35rem 0.25rem;
  border-bottom: 1px solid var(--line);
  list-style: none;
}
.skel > span {
  height: 13px;
  background: var(--surface);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.skel__no { width: 1.4rem; }
.skel__thumb { height: 4.4rem; width: 6rem; }
.skel__lines { display: flex; flex-direction: column; gap: 0.55rem; }
.skel__lines span { display: block; height: 13px; background: var(--surface); border-radius: 2px; position: relative; overflow: hidden; }
.skel__lines span:first-child { width: 58%; }
.skel__lines span:last-child { width: 36%; }
.skel__meta { width: 78%; height: 26px; }
.skel__price { width: 68%; }
.skel__view { width: 58%; }
.skel > span::after, .skel__lines span::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(243, 240, 234, 0.07), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
@media (max-width: 760px) {
  .skel { grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.4rem 1rem; padding: 1.1rem 0.25rem; }
  .skel__no, .skel__meta, .skel__view { display: none; }
  .skel__thumb { height: 4.5rem; width: 4.5rem; }
}

/* ---------- Empty state ---------- */
.empty {
  padding: 4rem 1rem;
  text-align: left;
  max-width: 46ch;
}
.empty__title {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0 0 0.6rem;
  font-weight: 600;
}
.empty__body {
  margin: 0 0 1.5rem;
  color: var(--text-2);
}
.empty__action {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--rad);
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  transition: transform 0.1s var(--ease), background 0.2s var(--ease);
}
.empty__action:hover { background: var(--accent-2); }
.empty__action:active { transform: translateY(1px); }

/* ---------- Colophon ---------- */
.colophon {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}
.colophon__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem var(--gut);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 2rem;
  justify-content: space-between;
  align-items: baseline;
}
.colophon__line {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--text);
}
.colophon__note {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ============================================================
   Detail dialog (editorial article panel)
   ============================================================ */
.detail {
  width: min(980px, 94vw);
  max-width: 980px;
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  background: var(--bg-2);
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.55);
}
.detail::backdrop { background: rgba(8, 9, 11, 0.66); backdrop-filter: blur(3px); }

.detail[open] { animation: slidein 0.4s var(--ease); }
@keyframes slidein {
  from { transform: translateX(28px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.detail__grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  height: 88vh;
  max-height: 88vh;
}
.detail__media {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}
.detail__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.45));
}
.detail__body {
  padding: clamp(1.6rem, 3vw, 2.6rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.detail__close {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.detail__close svg { width: 14px; height: 14px; }
.detail__close:hover { border-color: var(--accent); color: var(--text); }

.detail__kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.detail__title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0;
}
.detail__body-text {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text-2);
  max-width: 46ch;
}

.detail__specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}
.detail__spec {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.detail__spec:nth-child(odd) { padding-right: 1rem; }
.detail__spec:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--line); }
.detail__spec dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.detail__spec dd {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text);
  font-weight: 500;
}

.detail__price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--serif);
}
.detail__price-n { font-size: 2rem; font-weight: 600; letter-spacing: -0.01em; }
.detail__price-l { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

.detail__actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.2rem;
}
.save-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.1s var(--ease);
}
.save-btn svg { width: 17px; height: 17px; }
.save-btn:hover { border-color: var(--accent); }
.save-btn:active { transform: translateY(1px); }
.save-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.save-btn[aria-pressed="true"]:hover { background: var(--accent-2); border-color: var(--accent-2); }

.detail__back {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.detail__back:hover { border-color: var(--accent); color: var(--text); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 760px) {
  .masthead__inner { height: 60px; gap: 0.8rem; }
  .masthead__meta { gap: 0.7rem; font-size: 12px; }
  .masthead__stat { display: none; }
  .masthead__stat, .masthead__saved { gap: 0.3rem; }
  .masthead__divider { display: none; }

  .tools { gap: 0.9rem; }
  .field--search { flex-basis: 100%; }
  .field--saved { flex-basis: 100%; }
  .field__label { font-size: 10.5px; }
  .tools__count { margin-left: 0; width: 100%; }

  .work__open {
    grid-template-columns: 4.5rem minmax(0, 1fr);
    grid-template-areas:
      "thumb title"
      "thumb meta"
      "thumb price";
    gap: 0.4rem 1rem;
    padding: 1.1rem 0.25rem;
  }
  .work__no { display: none; }
  .work__thumb { grid-area: thumb; width: 4.5rem; height: 4.5rem; align-self: center; }
  .work__head { grid-area: title; }
  .work__date { grid-area: meta; font-size: 0.78rem; color: var(--muted); }
  .work__date strong { display: inline; color: var(--muted); font-weight: 500; }
  .work__price { grid-area: price; text-align: left; font-size: 1.2rem; }
  .work__price small { display: inline; margin-left: 0.3rem; }
  .work__view { display: none; }
  .work__sub .work__instructor { display: none; }

  .detail { max-height: 92vh; }
  .detail__grid {
    grid-template-columns: 1fr;
    grid-template-rows: 38vh 1fr;
    height: 92vh;
    max-height: 92vh;
  }
  .detail__media { height: 38vh; }
  .detail__body { padding: 1.3rem; }
  .detail__spec:nth-child(even) { padding-left: 1rem; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .work { opacity: 1; transform: none; }
  .detail[open] { transform: none; opacity: 1; }
}
