/* =========================================================================
   THE FORM LAB — shared design system for formaltrousersthane.com
   Page-specific compositions live in assets/css/pages/*.css
   ========================================================================= */

:root {
  --ultra: #2839D8;
  --ultra-deep: #1C2AA8;
  --ivory: #F2EFE5;
  --verm: #E95336;
  --verm-ink: #C23C1E;      /* darker vermilion for small text on light grounds */
  --verm-light: #F2735A;    /* lighter vermilion for small text on carbon (AA) */
  --carbon: #202124;
  --mist: #D8D9D5;
  --lav: #B9B9CE;
  --ink-soft: #4A4B50;

  --f-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-text: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --f-cond: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;

  --gutter: clamp(16px, 4vw, 64px);
  --max: 1480px;
  --mast-h: 76px;
  --rail-w: 0px;

  --t-mega: clamp(4.2rem, 15vw, 15rem);
  --t-xxl: clamp(3rem, 8vw, 8.25rem);
  --t-xl: clamp(2.4rem, 5.4vw, 5.25rem);
  --t-l: clamp(1.9rem, 3.4vw, 3.25rem);
  --t-m: clamp(1.4rem, 2.2vw, 2rem);
  --t-s: clamp(1.1rem, 1.4vw, 1.3rem);
  --t-body: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);

  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}
@media (min-width: 1200px) { :root { --rail-w: 56px; } }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--mast-h) + 16px); }
body {
  margin: 0; background: var(--ivory); color: var(--carbon);
  font-family: var(--f-text); font-size: var(--t-body); line-height: 1.65;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
@supports (overflow: clip) { body { overflow-x: clip; } }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 500; line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 .5em; text-wrap: balance; }
p { margin: 0 0 1em; }
p, li { text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
address { font-style: normal; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--verm); outline-offset: 3px; }
.t-ultra :focus-visible, .t-verm :focus-visible { outline-color: var(--ivory); }
::selection { background: var(--ultra); color: var(--ivory); }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 200; background: var(--carbon); color: var(--ivory); padding: 10px 16px; text-decoration: none; }
.skip-link:focus { top: 12px; }
main { display: block; padding-left: var(--rail-w); }
[role="region"][tabindex] { position: relative; }
main:focus { outline: none; }

/* ---------- page transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fl-out .28s var(--ease) both; }
::view-transition-new(root) { animation: fl-in .42s var(--ease) both; }
@keyframes fl-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes fl-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- layout primitives ---------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: 920px; }
.section { padding-block: clamp(72px, 11vw, 168px); position: relative; }
.section--tight { padding-block: clamp(48px, 7vw, 96px); }

/* colour themes — sections choose one */
.t-ivory { background: var(--ivory); color: var(--carbon); }
.t-mist { background: var(--mist); color: var(--carbon); }
.t-lav { background: var(--lav); color: var(--carbon); }
.t-ultra { background: var(--ultra); color: var(--ivory); }
.t-carbon { background: var(--carbon); color: var(--ivory); }
.t-verm { background: var(--verm); color: var(--carbon); }

/* ---------- type primitives ---------- */
.label {
  display: inline-block; font-family: var(--f-display); font-size: .75rem; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; line-height: 1.4; margin: 0 0 1rem;
}
.label--accent { color: var(--verm-ink); }
.t-carbon .label--accent, .t-ultra .label--accent { color: var(--verm-light); }
.t-ultra .label--accent { color: #FFB8A8; }
.label--light { color: var(--lav); }
.label--rule { display: flex; align-items: center; gap: 14px; }
.label--rule::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .35; }

.mega { font-family: var(--f-cond); font-weight: 800; font-size: var(--t-mega); line-height: .82; letter-spacing: -0.01em; text-transform: uppercase; margin: 0; }
.h-xxl { font-size: var(--t-xxl); line-height: .95; letter-spacing: -0.035em; }
.h-xl { font-size: var(--t-xl); line-height: .98; letter-spacing: -0.03em; }
.h-l { font-size: var(--t-l); line-height: 1.04; }
.h-m { font-size: var(--t-m); line-height: 1.12; letter-spacing: -0.01em; }
.h-s { font-size: var(--t-s); line-height: 1.25; letter-spacing: 0; font-weight: 700; }
.lede { font-family: var(--f-display); font-size: clamp(1.2rem, 1.9vw, 1.65rem); line-height: 1.35; letter-spacing: -0.01em; max-width: 34ch; }
.prose { max-width: 66ch; }
.prose h3 { font-size: var(--t-s); font-weight: 700; margin-top: 2em; letter-spacing: 0; }
.prose ul { padding-left: 1.2em; margin-bottom: 1em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--verm-ink); }
.t-carbon .prose li::marker, .t-ultra .prose li::marker { color: var(--verm); }
.muted { color: var(--ink-soft); }
.t-carbon .muted, .t-ultra .muted { color: #D9D9E4; }
.numeral { font-family: var(--f-cond); font-weight: 800; line-height: .8; font-size: clamp(5rem, 14vw, 13rem); letter-spacing: -0.02em; display: block; }
.numeral--outline { -webkit-text-fill-color: transparent; -webkit-text-stroke: 2px currentColor; }
.numeral--verm { color: var(--verm); }
.numeral--ultra { color: var(--ultra); }
.vlabel { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--f-display); font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
.accent { color: var(--verm-ink); }
.t-carbon .accent, .t-ultra .accent { color: var(--verm-light); }
.t-ultra .accent { color: #FFB8A8; }

/* ---------- plates: exhibition image frames (never crop) ---------- */
.plate { margin: 0; position: relative; }
.plate__frame { background: var(--mist); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.plate__frame img { width: 100%; height: auto; }
.plate__frame--pad { padding: clamp(12px, 2vw, 28px); }
.plate--ultra .plate__frame { background: var(--ultra); }
.plate--carbon .plate__frame { background: var(--carbon); }
.plate--lav .plate__frame { background: var(--lav); }
.plate--ivory .plate__frame { background: var(--ivory); }
.plate--verm .plate__frame { background: var(--verm); }
.plate__cap { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; padding-top: 10px; font-size: .8125rem; line-height: 1.45; border-top: 1px solid currentColor; margin-top: 10px; }
.plate__no { font-family: var(--f-display); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; font-size: .7rem; white-space: nowrap; color: var(--verm-ink); }
.t-carbon .plate__no, .t-ultra .plate__no { color: var(--verm-light); }
.t-lav .plate__no, .t-verm .plate__no, .t-lav .label--accent, .t-verm .label--accent, .t-lav .accent, .t-verm .accent { color: var(--carbon); }
.t-ultra .plate__no { color: #FFB8A8; }
/* fixed-height plate that still shows the whole garment */
.plate--fit .plate__frame { height: var(--plate-h, min(70vh, 760px)); }
.plate--fit .plate__frame img { width: auto; height: 100%; max-width: 100%; object-fit: contain; }

/* ---------- links & buttons ---------- */
.link-arrow { display: inline-flex; align-items: center; gap: .6em; font-family: var(--f-display); font-weight: 500; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 4px; min-height: 44px; transition: gap .3s var(--ease), color .2s; }
.link-arrow::after { content: "→"; transition: transform .3s var(--ease); }
.link-arrow:hover { gap: 1em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .7em; min-height: 52px; padding: 14px 26px; font-family: var(--f-display); font-weight: 500; letter-spacing: .02em; text-decoration: none; border: 1.5px solid currentColor; transition: background .25s, color .25s; }
.btn:hover { background: var(--carbon); color: var(--ivory); border-color: var(--carbon); }
.btn--solid { background: var(--ultra); color: var(--ivory); border-color: var(--ultra); }
.btn--solid:hover { background: var(--carbon); border-color: var(--carbon); }
.t-ultra .btn:hover, .t-carbon .btn:hover { background: var(--ivory); color: var(--carbon); border-color: var(--ivory); }

/* ---------- rules & graphic devices ---------- */
.rule { border: 0; height: 1px; background: currentColor; opacity: .25; margin: 0; }
.rule--heavy { height: 6px; opacity: 1; background: var(--ultra); }
.ticks { height: 14px; background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 12px); opacity: .45; }
.ticks--major { background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 12px), repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 60px); background-size: auto 50%, auto 100%; background-repeat: repeat-x; background-position: bottom, bottom; }
.dot { display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: var(--verm); vertical-align: middle; }
.chip { display: inline-block; font-family: var(--f-display); font-size: .78rem; letter-spacing: .06em; padding: 6px 12px; border: 1px solid currentColor; border-radius: 999px; }

/* ---------- expandable content ---------- */
.expand { border-top: 1px solid currentColor; }
.expand:last-of-type { border-bottom: 1px solid currentColor; }
.expand summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 22px 0; font-family: var(--f-display); font-size: var(--t-s); font-weight: 500; min-height: 44px; }
.expand summary::-webkit-details-marker { display: none; }
.expand summary::after { content: "+"; font-size: 1.6em; line-height: 1; transition: transform .3s var(--ease); color: var(--verm-ink); }
.t-carbon .expand summary::after, .t-ultra .expand summary::after { color: var(--verm); }
.expand[open] summary::after { transform: rotate(45deg); }
.expand__body { padding: 0 0 28px; max-width: 70ch; }

/* ---------- breadcrumbs ---------- */
.crumbs { padding: 18px var(--gutter) 0; max-width: var(--max); margin-inline: auto; font-family: var(--f-display); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 0; }
.crumbs li + li::before { content: "/"; margin: 0 10px; opacity: .5; }
.crumbs a { text-decoration: none; border-bottom: 1px solid transparent; }
.crumbs a:hover { border-color: currentColor; }
.crumbs [aria-current] { color: var(--verm-ink); }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 90; height: var(--mast-h);
  display: flex; align-items: center; gap: clamp(14px, 2.4vw, 36px);
  padding-inline: var(--gutter); background: rgba(242, 239, 229, .94);
  backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(32, 33, 36, .14);
}
.masthead__logo { flex: none; display: block; padding: 4px; margin-left: -4px; }
.masthead__logo img { height: 46px; width: auto; }
.masthead__lab { display: none; margin: 0; font-family: var(--f-display); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; line-height: 1.35; padding-left: 18px; border-left: 2px solid var(--ultra); }
.masthead__lab span { display: block; }
.masthead__lab span:first-child { color: var(--ultra); font-weight: 700; }
.masthead__quick { display: none; margin-left: auto; }
.masthead__quick ul { list-style: none; display: flex; gap: clamp(14px, 1.6vw, 28px); }
.masthead__quick a { display: flex; align-items: baseline; gap: 6px; text-decoration: none; font-family: var(--f-display); font-size: .9rem; font-weight: 500; padding: 10px 0; position: relative; white-space: nowrap; }
.masthead__quick a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 2px; background: var(--ultra); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.masthead__quick a:hover::after, .masthead__quick a[aria-current]::after { transform: scaleX(1); }
.qn { font-size: .66rem; color: var(--verm-ink); letter-spacing: .06em; }
.index-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; background: var(--ultra); color: var(--ivory); border: 0; cursor: pointer; font-family: var(--f-display); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.index-toggle:hover { background: var(--carbon); }
.index-toggle__count { font-size: .66rem; padding: 2px 6px; border: 1px solid currentColor; border-radius: 99px; }
.index-toggle__bars { display: grid; gap: 5px; width: 20px; }
.index-toggle__bars i { display: block; height: 2px; background: currentColor; transition: transform .3s var(--ease); }
.index-toggle[aria-expanded="true"] .index-toggle__bars i:first-child { transform: translateY(3.5px) rotate(45deg); }
.index-toggle[aria-expanded="true"] .index-toggle__bars i:last-child { transform: translateY(-3.5px) rotate(-45deg); }
@media (min-width: 860px) { .masthead__lab { display: block; } }
@media (min-width: 1180px) { .masthead__quick { display: block; } .index-toggle { margin-left: 8px; } }
@media (max-width: 380px) { .masthead__logo img { height: 40px; } .index-toggle__count { display: none; } }

/* ---------- full-screen index panel ---------- */
.index-panel { position: fixed; inset: 0; z-index: 120; background: var(--ultra); color: var(--ivory); overflow-y: auto; overscroll-behavior: contain; }
.index-panel[hidden] { display: none; }
.index-panel.is-open { animation: panel-in .45s var(--ease) both; }
@keyframes panel-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.index-panel__inner { min-height: 100%; display: grid; grid-template-rows: auto 1fr auto; padding: 20px var(--gutter) 32px; max-width: var(--max); margin-inline: auto; }
.index-panel__head { display: flex; justify-content: space-between; align-items: center; min-height: 56px; border-bottom: 1px solid rgba(242,239,229,.35); }
.index-panel__head .label { margin: 0; }
.index-panel__close { background: none; border: 1.5px solid currentColor; min-height: 48px; padding: 0 18px; cursor: pointer; font-family: var(--f-display); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; }
.index-panel__close:hover { background: var(--ivory); color: var(--ultra); }
.index-panel__list { list-style: none; columns: 1; padding: 18px 0; }
.index-panel__list li { break-inside: avoid; border-bottom: 1px solid rgba(242,239,229,.18); }
.index-panel__list a { display: flex; align-items: baseline; gap: 16px; padding: 10px 0; text-decoration: none; font-family: var(--f-display); font-size: clamp(1.35rem, 3.4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; transition: color .2s, padding .35s var(--ease); }
.index-panel__no { font-size: .8rem; letter-spacing: .1em; color: #FFB8A8; min-width: 2.2em; }
.index-panel__list a:hover, .index-panel__list a[aria-current] { padding-left: 14px; color: #FFD9CF; }
.index-panel__list a[aria-current] .index-panel__name::after { content: " ●"; color: var(--verm); font-size: .5em; vertical-align: middle; }
.index-panel__foot { display: grid; gap: 16px; padding-top: 22px; border-top: 1px solid rgba(242,239,229,.35); font-size: .95rem; }
.index-panel__foot p { margin: 0; }
.index-panel__foot .label { display: block; margin-bottom: 4px; color: #FFB8A8; }
.index-panel__foot a { word-break: break-word; }
@media (min-width: 900px) {
  .index-panel__list { columns: 2; column-gap: 64px; }
  .index-panel__foot { grid-template-columns: 2fr 1fr 1.3fr; }
}
body.panel-open { overflow: hidden; }

/* ---------- vertical rail ---------- */
.rail { display: none; }
@media (min-width: 1200px) {
  .rail { display: flex; position: fixed; left: 0; top: var(--mast-h); bottom: 0; width: var(--rail-w); z-index: 40; flex-direction: column; align-items: center; gap: 18px; padding: 26px 0; margin: 0; border-right: 1px solid rgba(32,33,36,.14); background: var(--ivory); font-family: var(--f-display); text-transform: uppercase; letter-spacing: .18em; font-size: .7rem; }
  .rail__no { font-family: var(--f-cond); font-weight: 800; font-size: 1.6rem; letter-spacing: 0; color: var(--ultra); }
  .rail__name { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
  .rail::after { content: ""; flex: 1; width: 1px; background: linear-gradient(var(--verm) var(--progress, 0%), rgba(32,33,36,.18) var(--progress, 0%)); }
}

/* ---------- footer / colophon ---------- */
.colophon { background: var(--carbon); color: var(--ivory); padding: clamp(64px, 9vw, 128px) var(--gutter) 28px; padding-left: calc(var(--gutter) + var(--rail-w)); position: relative; z-index: 41; }
.colophon a { text-decoration-color: rgba(242,239,229,.45); }
.colophon a:hover { color: #FFB8A8; }
.colophon__statement { max-width: var(--max); margin: 0 auto clamp(48px, 7vw, 96px); display: grid; gap: 24px; }
.colophon__big { font-family: var(--f-cond); font-weight: 800; text-transform: uppercase; line-height: .8; font-size: clamp(4.5rem, 19vw, 19rem); margin: 0; display: flex; flex-wrap: wrap; gap: 0 .18em; }
.colophon__big span:nth-child(2) { color: var(--ultra); -webkit-text-stroke: 0; }
.colophon__big span:nth-child(3) { color: transparent; -webkit-text-stroke: 2px var(--verm); }
.colophon__sub { font-family: var(--f-display); font-size: var(--t-s); max-width: 40ch; margin: 0; color: #E5E3DC; }
.colophon__grid { max-width: var(--max); margin: 0 auto; display: grid; gap: 40px; padding-top: 40px; border-top: 6px solid var(--ultra); }
.colophon__logo { display: inline-block; background: var(--ivory); padding: 14px; }
.colophon__logo img { width: 150px; }
.colophon__name { font-family: var(--f-display); font-weight: 500; margin: 14px 0 0; }
.colophon__contact p { margin: 0 0 18px; max-width: 34ch; }
.colophon__contact .label, .colophon__index .label, .colophon__social .label { display: block; margin-bottom: 6px; }
.colophon__contact a { font-family: var(--f-display); font-size: 1.1rem; word-break: break-word; }
.colophon__index ol { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; }
.colophon__index a { display: flex; gap: 8px; text-decoration: none; padding: 6px 0; font-size: .92rem; min-height: 36px; align-items: baseline; }
.colophon__index a span { color: var(--verm-light); font-size: .7rem; font-family: var(--f-display); }
.colophon__index a:hover { text-decoration: underline; }
.social { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.social li { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(242,239,229,.4); border-radius: 50%; font-size: 1.1rem; }
.colophon__base { max-width: var(--max); margin: clamp(48px, 6vw, 80px) auto 0; padding-top: 22px; border-top: 1px solid rgba(242,239,229,.2); display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; font-size: .85rem; color: #D9D9E4; }
.colophon__base p { margin: 0; }
.colophon__base a { color: var(--ivory); }
.to-top { margin-left: auto; background: none; border: 1px solid rgba(242,239,229,.5); color: var(--ivory); min-height: 44px; padding: 0 16px; cursor: pointer; font-family: var(--f-display); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.to-top:hover { background: var(--ivory); color: var(--carbon); }
@media (min-width: 720px) { .colophon__grid { grid-template-columns: 1fr 1.4fr; } }
@media (min-width: 1100px) { .colophon__grid { grid-template-columns: .9fr 1.3fr 1.3fr .8fr; } }

/* floating back-to-top */
.float-top { position: fixed; right: 16px; bottom: 16px; z-index: 80; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--verm); color: var(--carbon); font-size: 1.3rem; cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease); box-shadow: 0 6px 20px rgba(32,33,36,.2); }
.float-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.float-top:hover { background: var(--carbon); color: var(--ivory); }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}
@media print { .masthead, .rail, .index-panel, .float-top, .colophon__statement { display: none !important; } main { padding: 0; } }
