/* Fluidgram soft-launch catalogue.
   Colours are the brand's (apps/mockup/lib/brand/mark.ts MARK_COLOURS and the
   palette's apricot accent): a deep forest band like the Diwali card, cream
   paper for the products. One deliberate light page; the bands are dark in
   every theme. */

@font-face {
  font-family: "Work Sans Variable";
  src: url("assets/WorkSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --forest: #27443A;
  --forest-deep: #1D3229;
  --forest-lift: #3A5D4F;
  --cream: #F3F1E9;
  --paper: #FAF8F2;
  --ink: #1F2B26;
  --ink-2: #4F5B50;
  --line: #DCD5C2;
  --apricot: #F0B78F;
  --on-dark: #F3F1E9;
  --on-dark-2: #C9D3CC;

  --gutter: clamp(16px, 5vw, 72px);
  --radius: 14px;
  font-family: "Work Sans Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(56px, 8vw, 104px); }

h1, h2, h3 { text-wrap: balance; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(28px, 3.6vw, 40px); font-weight: 600; letter-spacing: -0.01em; color: var(--forest); }
h3 { font-size: 20px; font-weight: 600; color: var(--forest); }

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.section-lede { max-width: 62ch; margin: 14px 0 0; color: var(--ink-2); }

/* ------------------------------------------------------------- bands */

.band.hero {
  background:
    radial-gradient(ellipse 70% 80% at 30% 35%, var(--forest-lift), transparent 70%),
    var(--forest-deep);
  color: var(--on-dark);
}
.band.hero h1, .band.hero h2 { color: var(--on-dark); }
.band.soft { background: var(--cream); border-block: 1px solid var(--line); }

/* -------------------------------------------------------------- hero */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding-block: clamp(40px, 7vw, 96px);
}

.lockup { width: min(340px, 100%); height: auto; }
.lockup text { font-family: "Work Sans Variable", ui-sans-serif, system-ui, sans-serif; }

.tagline {
  margin: 22px 0 0;
  font-size: 20px;
  font-style: italic;
  font-weight: 500;
  color: var(--apricot);
}

.hero h1 {
  margin-top: 14px;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lede { max-width: 50ch; margin: 18px 0 0; color: var(--on-dark-2); font-size: 18px; }

.hero-figure { margin: 0; }
.hero-figure img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.55);
}
.hero-figure figcaption { margin-top: 10px; font-size: 13px; color: var(--on-dark-2); }

/* ----------------------------------------------------------- buttons */

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.button:focus-visible { outline: 3px solid var(--apricot); outline-offset: 3px; }

.band.hero .button.primary { background: var(--apricot); color: var(--forest-deep); }
.band.hero .button.primary:hover { background: #F5C9A8; }
.band.hero .button.quiet { border-color: rgb(243 241 233 / 0.45); color: var(--on-dark); }
.band.hero .button.quiet:hover { border-color: var(--on-dark); }


.more { margin: 32px 0 0; font-size: 18px; color: var(--forest); max-width: 62ch; }
.more a { font-weight: 600; text-underline-offset: 3px; }
.note { margin: 24px 0 0; font-size: 14px; color: var(--ink-2); max-width: 70ch; }

/* ------------------------------------------------------------ try it */

.try-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  grid-template-areas: "form side";
  gap: 18px clamp(24px, 4vw, 56px);
  align-items: start;
  margin-top: 32px;
}
.try-form { grid-area: form; }
/* The preview and its order button travel together: pinned side by side with the form on a wide
   screen, the picture no taller than leaves the button in view under it. */
.try-side { grid-area: side; display: grid; gap: 18px; }
.try-order { display: grid; gap: 12px; }
@media (min-width: 961px) {
  .try-side { position: sticky; top: 16px; }
  .try-side .try-preview .pic { width: min(100%, calc(100svh - 236px)); justify-self: center; }
}
.try-order p { margin: 0; font-size: 14px; color: var(--ink-2); max-width: 60ch; }

.try-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}
.try-form .wide, .try-form .choice, .try-form .birth-star { grid-column: 1 / -1; }
.try-form .fields { display: contents; }
.try-form .fields[hidden] { display: none; }
.birth-star { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.birth-star[hidden] { display: none; }

.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--forest); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #FFFFFF;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}
/* iPhone date and time fields keep a built-in minimum width and centre their text unless told not to */
.field input[type="date"], .field input[type="time"] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left;
}
.field input::-webkit-date-and-time-value { text-align: left; }
/* 16 px: below it, Safari on iPhone zooms the page in on every tap into a field and leaves it zoomed */
.field input, .field select, .field textarea { font-size: 16px; }
.field textarea { min-height: 72px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.field .hint { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .count { justify-self: end; font-size: 13px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--apricot); outline-offset: 1px; border-color: var(--forest); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #B42318; }
#try-name, .field input[autocapitalize="characters"] { text-transform: uppercase; letter-spacing: 0.04em; }

.choice { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.choice legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--forest); }
.choice label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #FFFFFF;
  font-weight: 600;
  cursor: pointer;
}
.choice label span { font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.choice label:has(input:checked) { border-color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.choice input { accent-color: var(--forest); }
.choice.colours .pick { display: inline-flex; align-items: center; gap: 8px; }
.choice.colours .name { font-weight: 600; color: inherit; font-size: inherit; }
.swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
  flex: none;
}
/* each colourway's frame colour and its accent, as on the frame */
.swatch.army-green { background: linear-gradient(135deg, #4B5320 55%, #B87333 55%); }
.swatch.marble-copper { background: linear-gradient(135deg, #DCDCD8 55%, #B87333 55%); }
.swatch.skin-army-green { background: linear-gradient(135deg, #E8B48E 55%, #4B5320 55%); }

.try-preview { margin: 0; display: grid; gap: 10px; }
.try-preview svg, .try-preview .viewer3d {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--cream);
  box-shadow: 0 24px 50px -30px rgb(0 0 0 / 0.45);
}
.try-preview .viewer3d { position: relative; overflow: hidden; touch-action: none; cursor: grab; }
.try-preview .viewer3d[hidden], .try-preview svg[hidden] { display: none; }
.viewer3d canvas { display: block; width: 100%; height: 100%; }
.viewer3d:focus-visible { outline: 3px solid var(--apricot); outline-offset: 3px; }
/* the 3D switch sits on the picture itself, so the pinned preview never changes height */
.try-preview .pic { position: relative; width: 100%; }
.view-switch {
  position: absolute; inset: auto 10px 10px 10px;
  display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  pointer-events: none;
}
.view-switch > * { pointer-events: auto; }
.view-switch .button {
  min-height: 44px; padding: 0 16px; font-size: 15px; white-space: pre;
  background: rgb(255 255 255 / 0.92); color: var(--forest); border-color: var(--forest);
  box-shadow: 0 4px 12px -6px rgb(0 0 0 / 0.4);
}
.view-switch .button[aria-pressed="true"] { background: var(--forest); color: var(--on-dark); }
.view-hint:empty { display: none; }
/* the price of the frame being designed, on the picture's top corner, as a shop tag */
.price-tag {
  position: absolute; top: 10px; left: 10px; z-index: 1; margin: 0;
  padding: 6px 12px; border-radius: 10px;
  background: var(--forest); color: var(--on-dark);
  box-shadow: 0 4px 12px -6px rgb(0 0 0 / 0.45);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.price-tag strong { display: block; font-size: 18px; font-weight: 700; }
.price-tag span { font-size: 12px; opacity: 0.85; }
.view-hint {
  margin-right: auto; padding: 4px 10px; border-radius: 999px;
  background: rgb(255 255 255 / 0.9); font-size: 13px; color: var(--ink-2);
}
.try-status { margin: 0; min-height: 1.5em; font-size: 15px; font-weight: 600; color: #B42318; }
.try-status:empty { display: none; }
.try-order .button.primary { justify-self: start; background: var(--forest); color: var(--on-dark); }
.try-order .button.primary:hover { background: var(--forest-deep); }
.try-order .button[aria-disabled="true"] { opacity: 0.55; }

/* ------------------------------------------------------------- facts */

.facts {
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 36px;
}
.facts div { border-top: 2px solid var(--forest); padding-top: 12px; }
.facts dt { font-weight: 600; color: var(--forest); }
.facts dd { margin: 6px 0 0; color: var(--ink-2); font-size: 16px; }

/* ------------------------------------------------------------- steps */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
}
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--on-dark);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.steps p { margin: 6px 0 0; color: var(--ink-2); font-size: 16px; }

/* ----------------------------------------------------------- contact */

.contact .section { text-align: left; }

/* ------------------------------------------------------------ footer */

.footer { padding-block: 32px 40px; font-size: 15px; color: var(--ink-2); }
.footer p { margin: 4px 0; }
.footer a { display: inline-block; padding-block: 10px; }   /* a 44 px target for a thumb */
.footer .small { margin-top: 12px; font-size: 13px; }

/* ------------------------------------------------------------ layout */

@media (max-width: 960px) {
  /* One column: the preview first and pinned to the top of the screen while the form scrolls
     under it, so every keystroke shows; the order button after the form. */
  .try-grid { grid-template-columns: 1fr; grid-template-areas: "preview" "form" "order"; }
  .try-side { display: contents; }
  .try-preview { grid-area: preview; }
  .try-order { grid-area: order; }
  .try-preview {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-block: 8px;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    background: var(--paper);
    box-shadow: 0 12px 16px -14px rgb(0 0 0 / 0.35);
  }
  /* The pinned preview takes about a third of what is visible - measured on the visual viewport, so
     it shrinks when the keyboard opens and leaves room for the field being typed in (preview.js sets
     --visible-h). A focused field scrolls to just below it (--preview-h), never under it. */
  .try-preview .pic { width: min(100%, calc(var(--visible-h, 100svh) * 0.34)); justify-self: center; }
  .view-switch { inset: auto 6px 6px 6px; }
  /* the pinned picture is small on a phone: just the price, in the frame's plain corner (the words stay for
     screen readers, and in the note under the preview) */
  .price-tag { top: 4px; left: 4px; padding: 3px 8px; border-radius: 8px; }
  .price-tag strong { font-size: 13px; }
  .price-tag span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .view-switch .button { min-height: 44px; min-width: 44px; padding: 0 12px; font-size: 14px; }
  .view-switch .button .long { display: none; }     /* "3D" / "flat view": a small chip, not a bar across the frame */
  .try-form :is(input, select, textarea) { scroll-margin-top: calc(var(--preview-h, 0px) + 16px); scroll-margin-bottom: 24px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* A phone on its side (wide and short; a phone upright with its keyboard open is short but narrow):
   too short to pin anything, so the preview scrolls with the page. */
@media (min-width: 560px) and (max-width: 960px) and (max-height: 520px) {
  .try-preview { position: static; margin-inline: 0; padding-inline: 0; box-shadow: none; }
  .try-preview .pic { width: min(100%, 70vh); }
  .try-form :is(input, select, textarea) { scroll-margin-top: 16px; }
}

@media (max-width: 720px) {
  /* The first screen of a phone holds the name, the headline, the order button and the top of the
     frame itself; the longer introduction follows the picture. */
  .hero-grid { grid-template-columns: 1fr; row-gap: 0; padding-block: 24px 36px; }
  .hero-copy { display: contents; }
  .lockup { order: 1; width: min(220px, 100%); }
  .tagline { order: 2; margin-top: 14px; font-size: 18px; }
  .hero h1 { order: 3; margin-top: 8px; font-size: clamp(28px, 8vw, 34px); }
  .hero .actions { order: 4; margin-top: 20px; }
  .hero-figure { order: 5; max-width: 420px; margin-top: 24px; }
  .lede { order: 6; margin-top: 18px; font-size: 17px; }
}

@media (max-width: 560px) {
  .facts, .steps { grid-template-columns: 1fr; }
  .try-form, .birth-star { grid-template-columns: 1fr; }
  /* six frames: two to a row, so the choice stays one glance above the fields */
  .choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .choice legend { grid-column: 1 / -1; }
  .choice label {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-content: center; align-items: center;
    min-height: 56px; padding: 8px 12px; border-radius: 14px; font-size: 15px; line-height: 1.25;
  }
  .choice label input { grid-row: span 2; }
  /* colours: three to a row, the radio and swatch over the name */
  .choice.colours { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice.colours label { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; padding: 10px; }
  .choice label span { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
