/* Our Story — sub-page. Builds on tokens and nav from styles.css. */

/* Type scale — six sizes only. Every text style on this page uses one of these. */
.os {
  --t-display: clamp(56px, 7.8vw, 112px);  /* hero title */
  --t-h2:      clamp(40px, 3.9vw, 56px);   /* section titles, headline figures */
  --t-num:     40px;                       /* stats, timeline years */
  --t-body:    19px;                       /* all running copy */
  --t-small:   14px;                       /* timeline labels, chart values */
  --t-label:   12px;                       /* uppercase labels, captions, buttons */
  background: #FFFFFF;
  color: var(--ink);
}
.os .nav { background: rgba(255, 255, 255, .94); }

.os .nav__inner { justify-content: space-between; }
.os-nav { display: flex; gap: 30px; margin-left: auto; }
.os-nav a, .os-back {
  font: 600 10px/1 var(--sans);
  letter-spacing: .18em;
  color: var(--body);
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
}
.os-nav a:hover { color: var(--ink); border-bottom-color: var(--clay-bright); }
.os-back { margin-left: 44px; white-space: nowrap; }
.os-back--near { margin-left: 28px; }
.os-back:hover { color: var(--clay); }

/* ---------- shared heading system: "01 —— LABEL" + serif statement ---------- */
.os-label {
  display: flex; align-items: center;
  font: 600 var(--t-label)/1.4 var(--sans); letter-spacing: .28em; text-transform: uppercase;
  color: var(--faint);
}
/* A short clay rule, then the label — no section numbers, as on the homepage. */
.os-label::before { content: ''; flex: none; width: 32px; height: 1px; margin-right: 14px; background: var(--clay); }
.os-h2 {
  margin-top: 22px;
  font: 500 var(--t-h2)/1.06 var(--serif);
  letter-spacing: -.02em;
  color: var(--ink);
}
.os-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 48px; margin-bottom: 64px; }
.os-head > div:first-child { flex: none; }  /* the heading keeps its line; the lead beside it wraps instead */
.os-head__lead { max-width: 720px; font: 400 var(--t-body)/1.6 var(--sans); color: var(--muted); }

/* ---------- hero ---------- */
.os-hero { padding-top: 104px; padding-bottom: 104px; }
.os-hero__title {
  font: 500 var(--t-display)/.95 var(--serif);
  letter-spacing: .005em;
  text-transform: uppercase;
  color: var(--ink);
}
.os-hero__foot {
  display: flex; justify-content: space-between; align-items: baseline; gap: 48px;
  margin-top: 44px; padding-top: 24px;
  border-top: 1px solid var(--line-strong);
}
.os-hero__sub { font: 400 var(--t-body)/1.6 var(--sans); color: var(--ink); }
.os-hero__aside { text-align: right; text-wrap: balance; font: 400 var(--t-body)/1.6 var(--sans); color: var(--muted); }

/* ---------- 01 founding ---------- */
.os-founding { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 96px; align-items: center; }
.os-founding__img { margin: 0; aspect-ratio: 4 / 5; max-height: 600px; background: var(--img-bg); overflow: hidden; }
.os-founding__img img { width: 100%; height: 100%; object-fit: cover; }
.os-founding__body { max-width: 720px; }

/* Headings: one line when it fits, otherwise two even lines — never a manual break. */
.os-hero__title, .os-h2 { text-wrap: balance; }

/* Short copy: split lines evenly so no paragraph ends on a stray word or two. */
.os-founding__body p, .os-head__lead, .os-connect__side p, .os-hero__sub { text-wrap: balance; }
.os-founding__body .os-h2 { margin-bottom: 36px; }
/* Both sentences get the same shape: two even lines, or one line each once the column is wide enough (~1560px screens). */
.os-founding__body p { max-width: 460px; font: 400 var(--t-body)/1.6 var(--sans); color: var(--body); }
@media (min-width: 1560px) { .os-founding__body p { max-width: none; } }
.os-founding__body p + p { margin-top: 14px; }

/* ---------- 02 journey: growth curve on a light band ---------- */
.os-journey { margin-top: 128px; padding: 112px 0 104px; background: #F6F3EE; }
.os-journey .os-head { margin-bottom: 40px; }
.os-counts { display: flex; gap: 56px; margin: 0; }
.os-count { display: flex; flex-direction: column-reverse; }
.os-count dd { font: 500 var(--t-h2)/.9 var(--serif); letter-spacing: -.02em; color: var(--clay); white-space: nowrap; font-variant-numeric: tabular-nums; }
.os-count dt { margin-top: 14px; font: 600 var(--t-label)/1.4 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--faint); }

.os-chart { position: relative; }
.os-chart__svg { display: block; width: 100%; height: auto; overflow: visible; }
.os-chart__base { stroke: #CFC8BD; stroke-width: 1; }
.os-chart__guides path { stroke: #D6CFC4; stroke-width: 1; stroke-dasharray: 2 5; }
.os-chart__area { fill: url(#os-area); }
.os-chart__curve { fill: none; stroke: var(--clay); stroke-width: 2.5; stroke-linecap: round; }
.os-chart__dots circle { fill: #F6F3EE; stroke: var(--clay); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; }
.os-chart__dots .is-now { fill: var(--clay); animation: os-pulse 2.6s ease-out infinite; }
@keyframes os-pulse {
  0%   { stroke-width: 2.5;  stroke-opacity: .5; }
  70%  { stroke-width: 22;   stroke-opacity: 0; }
  100% { stroke-width: 22;   stroke-opacity: 0; }
}
.os-chart__n text { font: 600 var(--t-small) var(--sans); fill: var(--faint); text-anchor: middle; }
.os-chart__n text:last-child { fill: var(--clay); }

/* Milestone labels sit under their dot, positioned by year (--x). */
.os-line { list-style: none; margin: 18px 0 0; padding: 0; position: relative; height: 108px; }
/* Centred under each dot (dots ~184px apart). Boxes are wider than the gap so the longest note
   (2006) still centres; the text itself never touches its neighbour's. One title line + one note line. */
.os-line li { position: absolute; top: 0; left: calc(var(--x) - 100px); width: 200px; text-align: center; }
.os-line h3, .os-line p { white-space: nowrap; }
.os-line time { display: block; font: 500 var(--t-num)/1 var(--serif); letter-spacing: -.02em; color: var(--ink); transition: color .3s ease; }
.os-line h3 { margin-top: 14px; font: 600 var(--t-small)/1.4 var(--sans); color: var(--ink); }
.os-line p { margin-top: 4px; font: 400 var(--t-small)/1.5 var(--sans); color: var(--muted); }
.os-line li:hover time { color: var(--clay); }

/* Scroll reveal (only when the script has run — no JS means everything is visible).
   The curve draws in 2.2s; each dot and label arrives roughly as the curve reaches it. */
.os-js .os-chart__curve { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.2s cubic-bezier(.45, .05, .35, 1); }
.os-js .os-chart__area { opacity: 0; transition: opacity 1.4s ease .9s; }
.os-js .os-chart__dots circle { transform: scale(0); transition: transform .5s cubic-bezier(.34, 1.56, .64, 1) calc(var(--i) * .31s + .1s); }
.os-js .os-chart__n text, .os-js .os-line li { opacity: 0; transition: opacity .7s ease calc(var(--i) * .31s + .25s), transform .7s cubic-bezier(.2, .7, .2, 1) calc(var(--i) * .31s + .25s); }
.os-js .os-line li { transform: translateY(10px); }
.os-js .os-chart__dots .is-now { animation-delay: 2.6s; }
.os-js .os-chart.is-in .os-chart__curve { stroke-dashoffset: 0; }
.os-js .os-chart.is-in .os-chart__area,
.os-js .os-chart.is-in .os-chart__n text { opacity: 1; }
.os-js .os-chart.is-in .os-chart__dots circle { transform: none; }
.os-js .os-chart.is-in .os-line li { opacity: 1; transform: none; }

/* ---------- 03 factory ---------- */
.os-factory { padding-top: 128px; }
.os-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
}
.os-stats > div { display: grid; grid-template-columns: 40px 1fr; column-gap: 18px; align-items: center; padding: 30px 24px; border-left: 1px solid var(--line); }
.os-stats > div:first-child { border-left: 0; padding-left: 0; }
.os-icon { grid-row: 1 / 3; width: 40px; height: 40px; fill: none; stroke: var(--clay); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.os-stats dd { grid-row: 1; grid-column: 2; font: 500 var(--t-num)/1 var(--serif); letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.os-stats dt { grid-row: 2; grid-column: 2; margin-top: 8px; font: 600 var(--t-label)/1.4 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }

.os-plan { margin: 56px 0 0; }
.os-plan svg { display: block; width: 100%; height: auto; }
.os-plan figcaption { margin-top: 10px; text-align: right; font: 600 var(--t-label)/1.5 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.p-wall { fill: none; stroke: #6E6860; stroke-width: 1.6; }
.p-post rect { fill: #FFFFFF; stroke: #6E6860; stroke-width: 1.2; }
.p-div { fill: none; stroke: #9C968D; stroke-width: 1; }
.p-sealed { fill: rgba(158, 78, 52, .07); stroke: var(--clay); stroke-width: 1.2; stroke-dasharray: 5 4; }
.p-door { stroke: #FFFFFF; stroke-width: 4; }
/* Plan text is in SVG units; the plan renders ~1.18× at desktop width, so 12 units ≈ the 14px small size. */
.p-l text { font: 500 12px var(--sans); fill: var(--ink); }
.p-l .p-acc { fill: var(--clay); }
.p-fx { fill: none; stroke: #7C766D; stroke-width: 1.2; stroke-linejoin: round; }
.p-flow path { fill: none; stroke: var(--clay); stroke-width: 2; }
.p-arr { fill: var(--clay); }
.p-in { fill: none; stroke: var(--ink); stroke-width: 2; }
.p-sm { font: 500 12px var(--sans); fill: var(--ink); }

/* Equipment + QC (moved here from the homepage factory section). */
.os-spec { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; margin-top: 72px; }
.os-spec__head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
  font: 700 var(--t-label)/1.4 var(--sans);
  letter-spacing: .2em;
  color: var(--faint);
}
.os-spec__list { margin: 0; }
.os-spec__list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.os-spec__list dt { font: 400 var(--t-small)/1.5 var(--sans); color: var(--body); }
.os-spec__list dd { font: 600 20px/1 var(--serif); color: var(--ink); }
.os-spec__note { margin-top: 16px; font: 400 var(--t-body)/1.6 var(--sans); color: var(--body); text-wrap: pretty; }

/* ---------- 04 connect ---------- */
.os-connect { margin-top: 128px; padding: 96px 0 104px; background: #F6F3EE; }
.os-connect__inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 48px; }
.os-connect__side { max-width: 560px; }
.os-connect__side p { font: 400 var(--t-body)/1.6 var(--sans); color: var(--muted); }
.os-btn {
  display: inline-flex; align-items: center; gap: 28px;
  height: 52px; margin-top: 22px; padding: 0 26px;
  background: var(--clay); color: #FFFFFF;
  font: 700 var(--t-label)/1 var(--sans); letter-spacing: .18em; text-decoration: none;
  transition: background .2s ease;
}
.os-btn span { font-size: 16px; font-weight: 400; letter-spacing: 0; transition: transform .2s ease; }
.os-btn:hover { background: #7E3D28; color: #FFFFFF; }
.os-btn:hover span { transform: translateX(4px); }

.os-footer { background: var(--dark); color: var(--on-dark-mut); }
.os-footer .container { min-height: 96px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.os-footer a { font: 400 18px/1 var(--serif); letter-spacing: .16em; color: var(--on-dark); text-decoration: none; }
.os-footer span { font: 600 var(--t-label)/1.6 var(--sans); letter-spacing: .18em; }
.os-footer span .os-footer__link { font: inherit; letter-spacing: inherit; color: inherit; }
.os-footer span .os-footer__link:hover { color: var(--on-dark); }

/* Display serif: same lower-contrast cut as the homepage headings (see styles.css).
   Must come after the rules above — the `font:` shorthand resets font-variation-settings. */
.os-h2, .os-hero__title, .os-count dd, .os-line time, .os-stats dd {
  font-variation-settings: 'opsz' 24;
}
/* Small serif figures use the sturdier small optical size, as on the homepage. */
.os-spec__list dd { font-variation-settings: 'opsz' 11; }

/* Arrival: the hero rises in, in step with the homepage → Our Story page transition
   (dmRise lives in styles.css). Also plays on a direct visit. */
.os-hero__title { animation: dmRise 1s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both; }
.os-hero__foot  { animation: dmRise 1s cubic-bezier(0.16, 1, 0.3, 1) 0.45s both; }
@media (prefers-reduced-motion: reduce) {
  .os-hero__title, .os-hero__foot { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .os-nav { display: none; }
  .os-founding { gap: 56px; }
  .os-chart__scroll { overflow-x: auto; }
  .os-chart { min-width: 1100px; margin: 0 100px; }
  .os-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .os-stats > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .os-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .os-spec { grid-template-columns: minmax(0, 1fr); gap: 40px; margin-top: 56px; }
  .os .nav__inner { padding: 0 16px; height: 60px; gap: 12px; }
  .os .nav__brand { font-size: 15px; letter-spacing: .12em; }
  .os-back, .os-back--near { margin-left: 0; }
  .os .container { padding-left: 16px; padding-right: 16px; }
  .os-hero { padding-top: 64px; padding-bottom: 64px; }
  .os-hero__title { font-size: clamp(46px, 14vw, 64px); }
  .os-hero__foot, .os-head, .os-connect__inner { flex-direction: column; align-items: flex-start; gap: 20px; }
  .os-hero__aside { text-align: left; }
  .os-founding { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .os-founding__img { aspect-ratio: 4 / 3; }
  .os-journey { margin-top: 80px; padding: 72px 0 80px; }
  .os-factory { padding-top: 80px; }
  .os-head { margin-bottom: 44px; }
  .os-counts { gap: 32px; }
  .os-count dd { font-size: 52px; }
  .os-stats { grid-template-columns: minmax(0, 1fr); }
  .os-stats > div, .os-stats > div:nth-child(3) { border-left: 0; padding: 22px 0; }
  .os-stats > div + div { border-top: 1px solid var(--line); }
  .os-plan__scroll { overflow-x: auto; }
  .os-plan__scroll svg { min-width: 720px; }
  .os-connect { margin-top: 80px; padding: 64px 0 72px; }
  .os-connect__inner { align-items: stretch; }
  .os-connect__side { max-width: none; }
  .os-btn { width: 100%; justify-content: space-between; }
  .os-footer .container { flex-direction: column; align-items: flex-start; justify-content: center; padding-top: 28px; padding-bottom: 28px; gap: 10px; }
}
/* Phones: the bar keeps the brand, the other page and HOME; contact stays one tap away at the foot of the page. */
@media (max-width: 560px) {
  .os-back--near:not(:last-child) { display: none; }
}
