/* ============================================================
   BARNES DESIGN WORKS
   Design direction: "Drawing Set"
   The page is the surface of an architectural drawing sheet.
   Signature element: the registration bracket, taken from the mark.
   Palette sampled from the Plan 001 renderings.
   ============================================================ */

/* ---------- 1. TOKENS ---------- */
:root {
  /* Surface. Warm drawing paper, never pure white. */
  --paper:        #F3F1EB;
  --paper-2:      #EAE7DF;
  --paper-3:      #E1DDD2;

  /* Ink. Charcoal sampled from the board siding, never pure black. */
  --ink:          #22242A;
  --ink-2:        #3A3D44;
  --graphite:     #6A675E;   /* 5.0:1 on paper  */
  --graphite-soft:#7C7970;   /* large text only */
  --paper-muted:  #A8A49B;   /* 6.2:1 on ink    */

  /* Rules */
  --rule:         #D6D2C7;   /* hairline, decorative */
  --rule-strong:  #8E8A7F;   /* 3.05:1 - interactive borders */
  --rule-ink:     #3D4048;   /* rules on dark ground */

  /* Accent. The cedar entry portal. Rare doses only. */
  --accent:       #A8611C;   /* 4.78:1 under white; 4.24:1 large on paper */
  --accent-text:  #8F5215;   /* 5.5:1 on paper - small accent text */
  --accent-lift:  #D79A5C;   /* accent on the ink ground */
  --accent-wash:  #F0E4D6;

  /* Secondary natural. Coming Soon markers only. */
  --sage:         #5F6B4E;   /* 5.0:1 on paper */
  --sage-wash:    #E6E7DE;

  /* Type. The display face is a low-contrast serif on purpose: a didone
     looked right next to the mark but its hairlines disappeared at
     reading sizes. This one keeps the classical shape and stays legible
     all the way down. */
  --display: Fraunces, "Iowan Old Style", Georgia, serif;
  --body:    Archivo, "Helvetica Neue", Arial, sans-serif;
  --mono:    "IBM Plex Mono", SFMono-Regular, Consolas, monospace;

  /* Scale */
  --step--2: clamp(0.68rem, 0.66rem + 0.10vw, 0.74rem);
  --step--1: clamp(0.80rem, 0.77rem + 0.14vw, 0.88rem);
  --step-0:  clamp(0.95rem, 0.91rem + 0.20vw, 1.06rem);
  --step-1:  clamp(1.13rem, 1.06rem + 0.34vw, 1.35rem);
  --step-2:  clamp(1.40rem, 1.26rem + 0.68vw, 1.85rem);
  --step-3:  clamp(1.85rem, 1.58rem + 1.32vw, 2.75rem);
  --step-4:  clamp(2.40rem, 1.90rem + 2.45vw, 4.10rem);
  --step-5:  clamp(3.00rem, 2.10rem + 4.40vw, 6.20rem);

  /* Measure and rhythm */
  --shell: 1440px;
  --gutter: clamp(1.25rem, 0.85rem + 2.0vw, 3.25rem);
  --band:  clamp(4.5rem, 3.2rem + 6.0vw, 9.5rem);

  /* Motion */
  --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-soft: cubic-bezier(0.33, 0.00, 0.10, 1);
  --t-fast: 240ms;
  --t-mid:  520ms;
  --t-slow: 900ms;
}

/* ---------- 2. RESET AND BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

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

.skip {
  position: absolute; left: var(--gutter); top: -100%;
  z-index: 200; background: var(--ink); color: var(--paper);
  padding: 0.7em 1.2em; font-family: var(--mono);
  font-size: var(--step--1); text-decoration: none;
  transition: top var(--t-fast) var(--ease);
}
.skip:focus { top: 0.75rem; }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- 3. THE ENVIRONMENT LAYER ----------
   One fixed ground behind everything: a faint drafting grid that
   drifts on a 96 second cycle, plus paper tooth. Scrolling should
   feel like moving across one sheet, not past stacked boxes.       */
.environment {
  position: fixed; inset: -6vmax; z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(to right, rgba(34,36,42,0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34,36,42,0.055) 1px, transparent 1px),
    linear-gradient(to right, rgba(34,36,42,0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34,36,42,0.028) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 16px 16px, 16px 16px;
  animation: drift 96s linear infinite;
}
.environment::after {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.3'/%3E%3C/svg%3E");
  mix-blend-mode: multiply; opacity: 0.3;
}
@keyframes drift {
  from { transform: translate3d(0,0,0); }
  to   { transform: translate3d(-96px,-96px,0); }
}
/* Lift the page regions above the fixed ground. Named individually on
   purpose: a blanket `body > *` rule also caught the skip link and
   turned its absolute positioning into relative, which parked it on
   screen permanently. */
main, .foot { position: relative; z-index: 1; }

/* ---------- 4. TYPOGRAPHY ---------- */
.display {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.018em;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 0, "WONK" 0;
}
h1.display { font-size: var(--step-5); }
h2.display { font-size: var(--step-4); }
h3.display { font-size: var(--step-3); line-height: 1.08; }
h4.display { font-size: var(--step-2); line-height: 1.15; }

.kicker {
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--graphite);
  font-weight: 500;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 46ch;
}
p { max-width: 68ch; }
.prose p + p { margin-top: 1.1em; }
.prose a { color: var(--accent-text); text-underline-offset: 0.22em; }

/* Sheet number style section index, drawn from the title block */
.plate-no {
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.18em;
  color: var(--accent-text);
}

/* ---------- 5. LAYOUT ---------- */
.shell {
  width: min(100% - (var(--gutter) * 2), var(--shell));
  margin-inline: auto;
}
.shell--narrow { width: min(100% - (var(--gutter) * 2), 62rem); margin-inline: auto; }
.band { padding-block: var(--band); }
.band--tight { padding-block: calc(var(--band) * 0.62); }

.band--ink { background: var(--ink); color: var(--paper); }
.band--ink .kicker { color: var(--paper-muted); }
.band--ink .lede { color: var(--paper-muted); }
.band--ink .plate-no { color: var(--accent-lift); }

.band--sunk { background: var(--paper-2); }

.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }
.band--ink .rule { background: var(--rule-ink); }

/* Section head: index plus title, aligned on the baseline the way a
   drawing sheet aligns its view titles. */
.plate-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
  align-items: baseline;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(2.25rem, 1.5rem + 3vw, 4rem);
}
.band--ink .plate-head { border-color: var(--rule-ink); }
@media (min-width: 62rem) {
  .plate-head { grid-template-columns: 14.5rem minmax(0, 1fr) minmax(0, 22rem); gap: 2.5rem; }
}
.plate-head__note {
  font-size: var(--step--1);
  color: var(--graphite);
  max-width: 36ch;
}
.band--ink .plate-head__note { color: var(--paper-muted); }

/* ---------- 6. THE SIGNATURE: REGISTRATION BRACKETS ----------
   Two open corners lifted from the frame in the mark. They draw
   themselves in as the plate scrolls into view.                    */
.brk { position: relative; }
.brk::before, .brk::after {
  content: "";
  position: absolute;
  width: clamp(22px, 3.2vw, 46px);
  height: clamp(22px, 3.2vw, 46px);
  border: 1px solid var(--accent);
  pointer-events: none;
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
.js .brk::before, .js .brk::after { opacity: 0; }
.brk::before {
  top: -10px; left: -10px;
  border-right: 0; border-bottom: 0;
  transform: translate(10px, 10px);
}
.brk::after {
  right: -10px; bottom: -10px;
  border-left: 0; border-top: 0;
  transform: translate(-10px, -10px);
}
.js .brk.is-in::before, .js .brk.is-in::after { opacity: 1; transform: translate(0, 0); }
.band--ink .brk::before, .band--ink .brk::after { border-color: var(--accent-lift); }

/* ---------- 7. NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(243, 241, 235, 0.86);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast) var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--rule); }
.nav__in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding-block: 0.9rem;
}
.nav__logo { display: block; line-height: 0; }
.nav__logo img { width: clamp(58px, 5.4vw, 76px); height: auto; }

.nav__links { display: none; gap: clamp(1.5rem, 2.4vw, 2.75rem); align-items: center; }
@media (min-width: 60rem) { .nav__links { display: flex; } }
.nav__link {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  position: relative;
  padding-block: 0.35em;
}
.nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-fast) var(--ease);
}
.nav__link:hover::after, .nav__link[aria-current="page"]::after { transform: scaleX(1); }
.nav__link[aria-current="page"] { color: var(--accent-text); }

.nav__right { display: flex; align-items: center; gap: 0.85rem; }
.nav__cta { display: none; }
@media (min-width: 42rem) { .nav__cta { display: inline-flex; } }

.nav__toggle {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: none; border: 1px solid var(--rule-strong);
  padding: 0.55em 0.9em; cursor: pointer;
  font-family: var(--mono); font-size: var(--step--2);
  letter-spacing: 0.16em; text-transform: uppercase;
}
@media (min-width: 60rem) { .nav__toggle { display: none; } }
.nav__toggle i { display: block; width: 16px; height: 1px; background: var(--ink); position: relative; }
.nav__toggle i::before, .nav__toggle i::after {
  content: ""; position: absolute; left: 0; width: 16px; height: 1px; background: var(--ink);
  transition: transform var(--t-fast) var(--ease);
}
.nav__toggle i::before { top: -5px; }
.nav__toggle i::after  { top: 5px; }
.nav__toggle[aria-expanded="true"] i { background: transparent; }
.nav__toggle[aria-expanded="true"] i::before { transform: translateY(5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] i::after  { transform: translateY(-5px) rotate(-45deg); }

.drawer {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-mid) var(--ease);
  border-top: 1px solid transparent;
  background: var(--paper);
}
.drawer[data-open="true"] { grid-template-rows: 1fr; border-top-color: var(--rule); }
.drawer__in { overflow: hidden; }
.drawer ul { padding-block: 0.25rem 1.5rem; }
.drawer li + li { border-top: 1px solid var(--rule); }
.drawer a {
  display: block; padding: 0.85em 0;
  font-family: var(--display); font-size: var(--step-2);
  text-decoration: none;
}
.drawer .btn { margin-top: 1.25rem; width: 100%; }
@media (min-width: 60rem) { .drawer { display: none; } }

/* ---------- 8. BUTTONS ---------- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  --btn-bd: var(--accent);
  --btn-fill: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.75em;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  padding: 0.95em 1.6em;
  font-family: var(--mono); font-size: var(--step--1);
  letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  position: relative; overflow: hidden;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn::before {
  content: ""; position: absolute; inset: 0;
  background: var(--btn-fill);
  transform: translateY(101%);
  transition: transform var(--t-mid) var(--ease);
  z-index: 0;
}
.btn > * { position: relative; z-index: 1; }
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }
.btn:hover, .btn:focus-visible { color: var(--paper); border-color: var(--ink); }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--rule-strong); }

.btn--on-ink { --btn-bg: transparent; --btn-fg: var(--paper); --btn-bd: var(--rule-ink); --btn-fill: var(--paper); }
.btn--on-ink:hover, .btn--on-ink:focus-visible { color: var(--ink); border-color: var(--paper); }

.btn--wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.btn__arrow { transition: transform var(--t-fast) var(--ease); }
.btn:hover .btn__arrow { transform: translateX(4px); }

.tlink {
  font-family: var(--mono); font-size: var(--step--1);
  letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; display: inline-flex; gap: 0.6em; align-items: center;
  padding-bottom: 0.3em; border-bottom: 1px solid var(--rule-strong);
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tlink:hover { color: var(--accent-text); border-color: var(--accent); }
.band--ink .tlink { border-color: var(--rule-ink); }
.band--ink .tlink:hover { color: var(--accent-lift); border-color: var(--accent-lift); }

.actions { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; align-items: center; }

/* Finger-sized targets on touch, added without moving any layout.
   Anything that is a link inside a sentence is deliberately left alone:
   inline links are exempt, and padding them out would wreck the prose. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .nav__link { min-height: 44px; display: inline-flex; align-items: center; }
  .tlink { min-height: 44px; }
  .nav__toggle { min-height: 44px; }
  .foot__list a,
  .foot__bar nav a,
  .legal__toc a,
  .drawer a { min-height: 44px; display: flex; align-items: center; }
  .legal__toc a { align-items: center; }
}
