/* Brand: iron-gall ink, red chalk and vellum (see C:/projects/elska-brand/README.md). */
@font-face { font-family: "Fraunces"; src: url("assets/fonts/Fraunces-Variable.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }   /* subset: Latin, SOFT 0, WONK 0, wght 400-600 */
/* Hand lettering on the working drawings; only fetched when a drawing is opened. */
@font-face { font-family: "IM Fell English"; src: url("assets/fonts/IMFellEnglish-Italic.woff2") format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/fonts/IBMPlexMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
/* Georgia scaled to Fraunces' widths, so the swap from fallback barely moves a line. */
@font-face { font-family: "Fraunces Fallback"; src: local("Georgia"); font-weight: 100 500; size-adjust: 102%; ascent-override: 96%; descent-override: 25%; }
@font-face { font-family: "Fraunces Fallback"; src: local("Georgia Bold"), local("Georgia-Bold"); font-weight: 501 900; size-adjust: 90.7%; ascent-override: 108%; descent-override: 28%; }
:root {
  --parchment: #f3ead8;
  --vellum: #f8f2e4;
  --ink: #1f1a17;        /* brand Ink */
  --sepia: #6b5f55;      /* Ink, diluted: rules, captions, construction lines */
  --umber: #3d352f;      /* Ink at reading strength for secondary text */
  --rule: #d9c9ad;
  --red: #b5482f;        /* brand Red chalk: links and accents, used sparingly */

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.122 0 0 0 0 0.102 0 0 0 0 0.090 0 0 0 1.4 -0.45'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.373 0 0 0 0 0.333 0 0 0 0.32 -0.1'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.373 0 0 0 0 0.333 0 0 0 0.9 -0.35'/%3E%3C/filter%3E%3Crect width='900' height='900' filter='url(%23m)'/%3E%3C/svg%3E");

  --display: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --body: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "Courier New", monospace;
  --gutter: 24px;
  --section-gap: 120px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: rgba(181, 72, 47, 0.2); }

html { background: var(--parchment); scroll-behavior: smooth; }
body {
  margin: 0;
  position: relative;
  isolation: isolate;
  background: transparent;
  color: var(--ink);
  font: 400 18px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Paper: fine fibre grain plus a slow, faint mottle, printed on the whole page so it scrolls with the content. */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--grain), var(--mottle);
  background-size: 220px 220px, 900px 900px;
  opacity: 0.12;
}
img { max-width: 100%; display: block; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

a { color: var(--red); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap { max-width: calc(1120px + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 28px;
  padding-bottom: 12px;
}
.brand { display: inline-block; line-height: 0; padding: 6px 10px; margin: -6px -10px; border-radius: 6px;
  background: radial-gradient(closest-side, rgba(243, 234, 216, 0.85) 60%, rgba(243, 234, 216, 0)); }   /* clear space over the gear */
.brand-logo { display: block; width: 360px; height: auto; }   /* brand minimum 240px */

/* Hero: the gear is a large background, anchored off the left edge; the text sits to its right. */
.site-header { position: relative; z-index: 3; }
.hero-band { position: relative; isolation: isolate; overflow-x: clip; }
.hero {
  --gear: min(118vh, 96vw, 1180px);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 560px);
  align-items: center;
  min-height: min(80vh, 780px);
  padding: 8px max(var(--gutter), calc(50vw - 560px)) 48px var(--gutter);
}
.hero-gear {
  position: absolute;
  z-index: 0;
  left: 0;
  top: 50%;
  width: var(--gear);
  transform: translate(-40%, -46%);
}

.gear {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: crosshair;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.gear:focus-visible { outline-offset: -2px; border-radius: 50%; }
.gear.is-static { cursor: default; }
.gear-canvas, .gear-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.gear-canvas { display: block; }

.hero-text { grid-column: 2; position: relative; z-index: 1; }
.hero-text::before {          /* a soft pool of paper so the text reads where it meets the gear */
  content: "";
  position: absolute;
  inset: -80px -60px -80px -90px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(243, 234, 216, 0.92) 55%, rgba(243, 234, 216, 0));
}
h1 {
  margin: 0 0 24px;
  font: 600 clamp(2.6rem, 4.9vw, 4.6rem)/1.06 var(--display);
  letter-spacing: -0.025em;
  max-width: 18ch;
  color: var(--ink);
}
.subline { font-size: 1.5rem; line-height: 1.55; color: var(--umber); max-width: 44ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-top: 32px; }
.hero-link2 { font-size: 1.1rem; padding: 12px 0; }
.hero-link2::after { content: "↓"; display: inline-block; margin-left: 0.3em; transition: transform 0.25s ease; }
.hero-link2:hover::after { transform: translateY(3px); }
.hero-link {
  display: inline-block;
  padding: 12px 28px;
  font: 600 1.1rem/1.2 var(--body);
  letter-spacing: 0.02em;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 2px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.hero-link:hover { background: var(--red); color: var(--vellum); text-decoration: none; }

/* Sections */
.section { position: relative; z-index: 1; margin-top: var(--section-gap); scroll-margin-top: 24px; }
.section-head { margin-bottom: 56px; max-width: 40em; }
h2 {
  margin: 0;
  font: 600 clamp(1.8rem, 2.8vw, 2.3rem)/1.15 var(--display);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.section-head h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  margin-top: 14px;
  background: var(--sepia);
}
.section-intro { margin-top: 16px; font-size: 1.15rem; color: var(--umber); }
h3 { margin: 4px 0 8px; font: 600 1.4rem/1.25 var(--display); letter-spacing: -0.01em; color: var(--ink); }

.tag {                       /* brand label: Plex Mono, lowercase, tracked */
  font: 500 0.78rem/1.3 var(--mono);
  text-transform: lowercase;
  letter-spacing: 0.2em;
  color: var(--red);
}
.summary { color: var(--ink); }
.result { margin-top: 12px; color: var(--umber); }
.result .hl { font-style: normal; font-weight: 600; color: var(--red); }

/* product cards */
.products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 32px; }
.card { display: flex; flex-direction: column; height: 100%; }
.frame {
  position: relative;
  aspect-ratio: 16 / 10;
  margin-bottom: 18px;
  padding: 6px;
  background: var(--grain-soft) 0 0 / 220px 220px, var(--vellum);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.frame::after {              /* inner offset rule */
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(31, 26, 23, 0.22);
  border-radius: 6px;
  pointer-events: none;
}
.frame img {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  object-fit: cover;
  border-radius: 3px;
}
.frame::before {             /* multiply a vellum wash: whites become paper, darks unchanged */
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 1;
  border-radius: 3px;
  background: var(--vellum);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.card-link { margin-top: auto; padding-top: 10px; padding-bottom: 10px; align-self: flex-start; font-size: 1.05rem; }
.card-link .arrow { display: inline-block; margin-left: 0.35em; transition: transform 0.25s ease; }
/* The whole card is the link's hit area; the frame answers the hover. */
.card.has-link { position: relative; }
.card.has-link .card-link::after { content: ""; position: absolute; inset: 0; }
.frame, .frame img { transition: border-color 0.3s ease, transform 0.6s cubic-bezier(.2,.7,.2,1); }
.frame { overflow: hidden; }
.card.has-link:hover .frame { border-color: var(--sepia); }
.card.has-link:hover .frame img { transform: scale(1.025); }
.card.has-link:hover .card-link .arrow { transform: translateX(4px); }
.card.has-link:hover .card-link { text-decoration: underline; }
.card .result { margin-bottom: 4px; font-weight: 600; color: var(--ink); }

/* Support */
.panels { display: grid; gap: 72px; }
.panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}
.drawing { margin: 0; width: 100%; }
.drawing img { width: 100%; height: auto; }
.panel-text { max-width: 25em; }
.drawing img { max-height: 360px; width: auto; max-width: 100%; margin: 0 auto; }
.panel:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.panel:nth-child(even) .drawing { order: 2; }

#contact { margin-top: calc(var(--section-gap) * 0.8); }

/* contact panel */
.contact-mark { width: 84px; height: auto; margin-bottom: -4px; }   /* the brand mark: tangled, made simple */
.contact {
  background: var(--grain-soft) 0 0 / 220px 220px, var(--vellum);
  border: 1px solid rgba(31, 26, 23, 0.22);
  border-radius: 8px;
  max-width: 760px;
  margin: 0 auto;
  padding: 52px 48px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}
.contact-prompt { font: 600 2rem/1.25 var(--display); letter-spacing: -0.02em; color: var(--ink); }
.contact-prompt::after {      /* the same hairline that sits under each h2 */
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  margin: 18px auto 0;
  background: var(--sepia);
}
.contact-note { color: var(--umber); font-size: 1.1rem; margin-top: -4px; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 40px; font: 500 0.9rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: lowercase; }
.contact-links { margin-top: 8px; gap: 14px 18px; }
.contact-links a {
  display: inline-block;
  min-width: 15em;
  text-align: center;
  padding: 12px 26px;
  border: 1px solid var(--red);
  border-radius: 2px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.contact-links a:hover { background: var(--red); color: var(--vellum); text-decoration: none; }

/* Reveal on scroll (only when JS runs and motion is welcome) */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.8s ease var(--d, 0ms), transform 0.8s cubic-bezier(.2,.7,.2,1) var(--d, 0ms); }
  .js .reveal.in { opacity: 1; transform: none; }
}

/* Skip link */
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 10px 16px; background: var(--vellum); border: 1px solid var(--red); }
.skip:focus { top: 12px; }

/* Footer */
.site-footer { margin-top: 88px; padding-bottom: 56px; }
.site-footer p {
  text-align: center;
  padding-top: 20px;
  max-width: 760px;
  margin: 0 auto;
  border-top: 1px solid var(--rule);
  font: 500 0.75rem/1.4 var(--mono);
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: var(--sepia);
}

/* The flywheel: a second background part at the foot of the page, turning in from the right.
   The band clips it to the page; only the button itself takes the pointer. */
body { position: relative; }
.tail-band {
  --wheel: min(64vw, 104vh, 980px);
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--wheel) * 0.9);
  overflow: clip;
  pointer-events: none;
  z-index: 0;
}
.tail-machine {
  position: absolute;
  right: 0; bottom: 0;
  width: var(--wheel);
  transform: translate(60%, 14%);   /* the visible arc only grazes the 760px contact column */
}
.tail-machine .gear { pointer-events: auto; }
.site-footer { position: relative; z-index: 1; }
/* Sections are wide boxes; let the pointer through their empty margins to the parts behind. */
.section, .site-footer { pointer-events: none; }
.section > *, .site-footer > * { pointer-events: auto; }

/* Responsive */
@media (min-width: 1200px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 640px); }   /* room for the headline in three lines */
}
@media (max-width: 760px) {
  /* phones: the wheel gets the last stretch of page to itself, below the footer line */
  /* and turns in from the bottom left, opposite the hero gear at the top right */
  body { --wheel: min(128vw, 560px); }
  .tail-band { --wheel: inherit; height: calc(var(--wheel) * 0.66); }
  .tail-machine { left: 0; right: auto; transform: translate(-38%, 30%); }
  .site-footer { padding-bottom: calc(var(--wheel) * 0.66 + 16px); }
}
@media (max-width: 1000px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 959px) {
  /* phones and tablets: the gear becomes a large background turning in from the top right,
     and the text rides up over its lower half, on a soft pool of paper */
  .hero {
    --gear: min(118vw, 92svh, 760px);
    display: block; min-height: 0;
    padding: calc(var(--gear) * 0.37) var(--gutter) 32px;
  }
  .hero-gear { left: auto; right: 0; top: 0; transform: translate(50%, -16%); }
  .hero-text { grid-column: auto; max-width: 560px; }
  h1 { font-size: clamp(2.2rem, 7.4vw, 3.6rem); }
  .hero-text::before { inset: -56px -40px -40px; }
}
@media (max-width: 760px) {
  .panel { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .panel:nth-child(even) { grid-template-columns: minmax(0, 1fr); }
  .panel:nth-child(even) .drawing { order: 0; }
}
@media (max-width: 699px) {
  .products { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  :root { --gutter: 20px; --section-gap: 80px; }
  body { font-size: 17px; }
  .site-header { padding-top: 20px; }
  .brand-logo { width: 280px; }
  .subline { font-size: 1.12rem; }
  .hero-actions { gap: 4px 24px; }
  .contact { padding: 40px 20px; }
  .contact-prompt { font-size: 1.6rem; }
  .hero { padding-bottom: 24px; }
  .section-head { margin-bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
