/* Tree, then drawing, then the goods. Colour leaves at the drawing and returns only on what you can take home. */
@import url("./tokens.css");
@import url("./base.css");

:root { --stage-h: calc(100svh - var(--sp-top, 0px) - var(--sp-h, 0px)); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
h1, h2, h3 { word-break: keep-all; font-weight: 600; }
b, strong { font-weight: 600; }
body { background: var(--color-paper); color: var(--color-ink); }
.demo { background: var(--color-paper-2); text-align: center; font-size: var(--text-xs); padding: var(--space-xs) var(--space-md); }
.demo a { font-weight: 600; }
.demo__plans { min-height: 24px; margin-left: var(--space-2xs); padding: 0 var(--space-xs); border: 1px solid currentColor; border-radius: var(--radius); background: transparent; color: inherit; font-size: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; }
body { padding-bottom: 76px; }
.apply { position: fixed; z-index: 2147482000; inset: auto 0 0; display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--gutter); padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom)); background: var(--color-paper); border-top: 1px solid var(--color-rule); }
.apply p { display: flex; flex-direction: column; min-width: 0; font-size: var(--text-sm); line-height: 1.35; }
.apply b { font-size: var(--text-md); }
.apply span { color: var(--color-ink-2); }
.fill { padding: 0 0.25em; border: 1px dashed currentColor; border-radius: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 var(--space-lg); border: 1px solid var(--color-ink); border-radius: var(--radius); background: transparent; color: var(--color-ink); font: 600 var(--text-md)/1 var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
.btn:hover { background: var(--color-paper-2); }
/* the one booking action carries the heartwood colour */
.btn--primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-paper); }
.btn--primary:hover { background: var(--color-accent-2); border-color: var(--color-accent-2); }
.btn--photo { background: var(--color-on-photo); border-color: var(--color-on-photo); color: var(--color-ink); }
.btn--photo:hover { background: transparent; color: var(--color-on-photo); }
.btn--photo:focus-visible { outline-color: var(--color-on-photo); }
.btn--wide { width: 100%; }

/* 1 + 2: the tree */
.tree { position: relative; }
.tree__stage { position: relative; height: var(--stage-h); min-height: 30rem; overflow: hidden; background: #2B241E; color: var(--color-on-photo); }
.tree__stage > img, #sky { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 48% 46%; }
#sky { display: none; touch-action: pan-y; }
html.tall .tree { height: 300vh; }
html.tall .tree__stage { position: sticky; top: var(--sp-top, 0px); }
html.gl #sky { display: block; }
.scrim { position: absolute; inset: 0; background: linear-gradient(100deg, rgba(24, 18, 12, 0.84) 0%, rgba(24, 18, 12, 0.66) 34%, rgba(24, 18, 12, 0) 68%); pointer-events: none; }
.top { position: absolute; z-index: var(--z-raised); inset: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); max-width: var(--container); margin-inline: auto; padding: var(--space-sm) var(--gutter); }
.word { font: 600 var(--text-lg)/1 var(--font-display); text-decoration: none; }
.top__book { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.top a:focus-visible { outline-color: var(--color-on-photo); }
.beat { position: absolute; z-index: var(--z-base); left: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter))); bottom: var(--space-2xl); width: min(34rem, calc(100% - 2 * var(--gutter))); }
.beat h1 { font-size: var(--text-display); line-height: 1.16; }
.beat h2 { font-size: var(--text-section); line-height: 1.25; }
.beat p { margin-top: var(--space-md); font-size: var(--text-lead); }
.beat .btn { margin-top: var(--space-lg); }
.beat--wood { display: none; }
html.gl .beat--wood { display: block; opacity: 0; visibility: hidden; }

/* 3: the drawing */
.dw { background: var(--color-paper); color: var(--color-ink); font-family: var(--font-drawing); padding-block: var(--space-2xl); }
.dw__stage { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: var(--space-xl); }
.dw__fig { display: none; min-width: 0; }
html.js .dw { height: 320vh; padding: 0; }
html.js .dw__stage { position: sticky; top: var(--sp-top, 0px); height: var(--stage-h); align-items: center; }
html.js .dw__fig { display: block; height: 100%; }
#log { display: block; width: 100%; height: 100%; overflow: visible; }
.dw h2 { font: 300 var(--text-section)/1.3 var(--font-drawing); letter-spacing: 0.02em; }
.block { margin-top: var(--space-md); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1.2px solid var(--color-ink); border-radius: 12px; font-size: var(--text-xs); }
.block div { padding: var(--space-xs); }
.block div + div { border-left: 0.8px solid var(--color-ink); }
.block dt { font-size: 0.625rem; }
.block dd { margin: 0; font-weight: 600; }
.notes { margin: var(--space-md) 0 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.notes li { display: grid; grid-template-columns: 1.25rem 3.5em minmax(0, 1fr); gap: var(--space-xs); padding-block: var(--space-2xs); transition: opacity var(--dur-short) linear; }
.notes .nb { display: inline-grid; place-items: center; width: 1.125rem; height: 1.125rem; border: 0.8px solid var(--color-ink); font-size: 0.6875rem; }
.notes b { font-weight: 600; }
html.dw-kept .notes li.gone { opacity: 0.4; }
.formula { margin-top: var(--space-sm); font-size: var(--text-xs); color: var(--color-ink-2); }
.verdict { margin-top: var(--space-sm); font-size: var(--text-md); font-weight: 600; }
#log text { font-family: var(--font-drawing); fill: var(--color-ink); }
#log .dt { font-size: 12px; paint-order: stroke; stroke: var(--color-paper); stroke-width: 4px; }
#log .nm { font-size: 14px; font-weight: 600; paint-order: stroke; stroke: var(--color-paper); stroke-width: 4px; }
#log .out { fill: var(--color-paper); stroke: var(--color-ink); stroke-width: 1.6; }
#log .grain { fill: none; stroke: var(--color-grain); stroke-width: 0.6; }
#log .lead { fill: none; stroke: var(--color-ink); stroke-width: 0.7; }
#log .dl { fill: none; stroke: var(--color-ink); stroke-width: 0.7; }
#log .cl { fill: none; stroke: var(--color-ink); stroke-width: 0.7; stroke-dasharray: 18 4 3 4; }
#log .ar { fill: var(--color-ink); }

/* 4: the goods */
.goods { padding-block: var(--section-gap) 0; }
.goods__head { font-size: var(--text-section); line-height: 1.25; }
.make { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-2xl); align-items: center; padding-block: var(--space-2xl); --q: 1; --p: 0; --t: 1; }
.make__art { position: relative; height: min(52svh, 460px); }
.make__art canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--p); transform: scale(calc(0.97 + 0.03 * var(--p))); }
.parts { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; gap: var(--space-lg); opacity: var(--q); pointer-events: none; }
.part { margin: 0; text-align: center; font: 400 var(--text-sm)/1.4 var(--font-drawing); transform: translateX(calc(var(--d, -1) * (1 - var(--t)) * 42%)); }
.part:last-child:not(:first-child) { --d: 1; }
.part svg { width: clamp(130px, 19vw, 240px); height: auto; margin-inline: auto; fill: var(--color-paper); stroke: var(--color-ink); stroke-width: 1.4; }
.part svg .g { fill: none; stroke: var(--color-grain); stroke-width: 0.7; }
.make h3 { font-size: var(--text-section); line-height: 1.25; font-family: var(--font-display); }
.make p { margin-top: var(--space-sm); color: var(--color-ink-2); }
.make .price { color: var(--color-ink); font-size: var(--text-lg); font-weight: 600; }
.make .btn { margin-top: var(--space-lg); }

.book { margin-top: var(--section-gap); padding-block: var(--section-gap); background: var(--color-paper-2); }
.book__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-2xl); align-items: start; }
.book h2, .find h2 { font-size: var(--text-section); line-height: 1.25; }
.book__head p { margin-top: var(--space-md); color: var(--color-ink-2); }
#booking { display: grid; gap: var(--space-lg); min-width: 0; }
.seg { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg legend, .field label, .field__label { display: block; padding: 0; margin-bottom: var(--space-xs); font-weight: 600; }
.seg__row { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { display: inline-flex; align-items: center; min-height: 48px; padding: 0 var(--space-md); border: 1px solid var(--color-ink); border-radius: var(--radius); cursor: pointer; }
.seg input:checked + label { background: var(--color-ink); color: var(--color-paper); }
.seg input:focus-visible + label { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.field { min-width: 0; }
.field input { width: 100%; min-height: 48px; padding: 0 var(--space-md); border: 1px solid var(--color-ink); border-radius: var(--radius); background: var(--color-paper); color: var(--color-ink); font-size: var(--text-lg); }
.field input[aria-invalid="true"] { border-color: var(--color-error); }
.help { margin-top: var(--space-2xs); font-weight: 600; color: var(--color-error); }
.help:empty { display: none; }
.stepper { display: inline-flex; align-items: center; gap: var(--space-md); }
.stepper button { width: 48px; height: 48px; border: 1px solid var(--color-ink); border-radius: var(--radius); background: transparent; color: var(--color-ink); font-size: var(--text-xl); cursor: pointer; }
.stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper output { min-width: 2ch; text-align: center; font-size: var(--text-xl); font-weight: 600; }
.sum { font-weight: 600; }
.note { font-size: var(--text-sm); color: var(--color-muted); }

.find { padding-block: var(--section-gap); }
.find p { margin-top: var(--space-sm); color: var(--color-ink-2); }
.find a { font-weight: 600; color: var(--color-ink); }
.foot { padding-block: var(--space-xl) calc(var(--space-xl) + var(--sp-h, 0px)); border-top: 1px solid var(--color-rule); font-size: var(--text-sm); color: var(--color-muted); }
.foot p + p { margin-top: var(--space-xs); }

@media (max-width: 60rem) {
  .dw__stage { grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); }
  html.js .dw__stage { grid-template-rows: minmax(0, 1fr) auto; align-items: stretch; padding-block: var(--space-sm); }
  html.js .dw__fig { grid-row: 1; height: auto; min-height: 0; }
  html.js .dw__text { grid-row: 2; }
  .dw h2 { font-size: var(--text-xl); }
  .block { display: none; }
  .formula { display: none; }
  .notes { margin-top: var(--space-xs); font-size: var(--text-xs); }
  .verdict { margin-top: var(--space-xs); font-size: var(--text-sm); }
  .make, .book__grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
  .make__art { height: 46svh; }
  .scrim { background: linear-gradient(0deg, rgba(24, 18, 12, 0.82) 0%, rgba(24, 18, 12, 0.5) 34%, rgba(24, 18, 12, 0) 62%); }
  .beat { bottom: var(--space-lg); }
  @media (max-width: 22.5rem) { html body.sp-top #demo-banner { font-size: 11px; } }
  /* the on-screen keyboard pushes a fixed bar over the field being typed in */
  body:has(#booking :is([type="text"], [type="date"]):focus) .apply { visibility: hidden; }
}

/* desktop: alternate the goods so the three do not read as one repeated card */
@media (min-width: 60.0625rem) {
  .make:nth-of-type(even) { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .make:nth-of-type(even) .make__art { order: 2; }
}

/* landscape phones: fit the hero between the two bars instead of clipping its button */
@media (max-height: 34rem) {
  .tree__stage { min-height: 0; }
  .beat { bottom: var(--space-md); }
  .beat h1 { font-size: 1.75rem; }
  .beat p { display: none; }
  .beat .btn { margin-top: var(--space-sm); }
}
