/* Midway Foundry */

:root {
  --navy: #0B1F3E;
  --navy-deep: #071934;
  --navy-raised: #0E284D;
  --ice: #E8F1FF;
  --mist: #C9D8EE;
  --steel: #9DB7DC;
  --steel-dark: #5F7FA8;
  --ink-soft: #3E5A80;
  --spark: #F58220;
  --spark-light: #FFB070;
  --rule: rgba(157, 183, 220, 0.22);
  --wrap: 1240px;
  --gutter: clamp(20px, 5vw, 64px);
  --rail: clamp(44px, 6vw, 72px);
  --spine: clamp(15px, 2.2vw, 23px);
  --deep: var(--navy-deep);
  --raised: var(--navy-raised);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--navy);
  color: var(--ice);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--spark); }
a:hover { color: var(--spark-light); }
:focus-visible { outline: 3px solid var(--spark); outline-offset: 3px; border-radius: 4px; }

h2 {
  margin: 0;
  font-size: clamp(38px, 5.4vw, 76px);
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: -0.015em;
  line-height: 1;
}
h3 { margin: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; margin: 0;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--spark); color: var(--navy); font-weight: 700;
  padding: 10px 16px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 12px; color: var(--navy); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px; border-radius: 8px;
  font-weight: 700; text-decoration: none;
}
.btn-primary { background: var(--spark); color: var(--navy); }
.btn-primary:hover { background: var(--spark-light); color: var(--navy); }
.btn-ghost { border: 1.5px solid var(--steel-dark); color: var(--ice); font-weight: 600; }
.btn-ghost:hover { border-color: var(--steel); color: var(--ice); }
.btn-small { min-height: 44px; padding: 0 18px; }

/* Header */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px 32px; padding-top: 24px; padding-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ice); text-decoration: none; }
.brand:hover { color: var(--ice); }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand > span { font-size: 20px; font-weight: 800; font-stretch: 112%; letter-spacing: -0.01em; line-height: 1; }
.brand-accent { color: var(--spark); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; font-size: 16px; }
.nav a:not(.btn) { color: var(--mist); text-decoration: none; padding: 10px 0; }
.nav a:not(.btn):hover { color: var(--ice); }

/* Hero */
.hero { --art:min(560px, 86vw, max(260px, calc((100svh - 230px) / 1.37)));
  position:relative; max-width:1240px; margin:0 auto; min-height:calc(100svh - 76px);
  display:grid; grid-template-columns:minmax(0,1fr); justify-items:center; align-content:center; gap:28px 64px;
  padding:0 var(--gutter) 72px; }
.hero-logo { display:flex; flex-direction:column; align-items:center; width:var(--art); }
.art { position:relative; width:100%; aspect-ratio:1080 / 1134; container-type:inline-size;
  padding:0; border:0; background:none; cursor:pointer; display:block; -webkit-tap-highlight-color:transparent; }
.art img, .art > span { position:absolute; pointer-events:none; }
.art img { inset:0; width:100%; height:100%; display:block; }
.art-hammer { transform-origin:73.5% 17.5%; opacity:0; }
.art-final { opacity:0; transition:opacity .6s ease-out; }
.is-forged .art-final { opacity:1; }
.art-flash { left:50%; top:65.4%; width:46%; aspect-ratio:2 / 1; translate:-50% -50%; border-radius:50%;
  background:radial-gradient(closest-side, rgba(255,236,200,.98), rgba(255,170,80,.7) 35%, rgba(245,130,32,.25) 65%, rgba(245,130,32,0)); opacity:0; mix-blend-mode:screen; }
.art-ring { left:50%; top:67.6%; width:56%; height:5%; translate:-50% -50%; border-radius:50%;
  border:2px solid rgba(255,190,120,.9); box-shadow:0 0 18px rgba(245,130,32,.7); opacity:0; }
.art-glow { left:50%; top:66.5%; width:30%; aspect-ratio:3 / 1; translate:-50% -50%; border-radius:50%;
  background:radial-gradient(closest-side, rgba(255,170,80,.75), rgba(245,130,32,0)); opacity:0; mix-blend-mode:screen; }
.is-live .art-glow { animation:breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 0%,100% { opacity:.45; } 50% { opacity:.18; } }
.art-fx, .art-idle { inset:0; }
.spark-digit { position:absolute; translate:-50% -50%; font-weight:800; line-height:1; color:#FF9A3C;
  text-shadow:0 0 .25em rgba(255,140,40,.95), 0 0 .6em rgba(245,110,20,.6); will-change:transform, opacity; }
.ember { position:absolute; translate:-50% -50%; border-radius:50%; background:#FFC27A; box-shadow:0 0 6px 2px rgba(255,140,40,.8); }
.hero-wordmark { width:100%; height:auto; aspect-ratio:1080 / 335; margin-top:-3%; display:block;
  opacity:0; clip-path:inset(0 100% 0 0); transition:clip-path .75s cubic-bezier(.65,0,.35,1) .25s, opacity .3s .25s; }
.is-forged .hero-wordmark { opacity:1; clip-path:inset(0 0 0 0); }

.hero-copy { display:none; text-align:center; max-width:36rem; }
.is-split .hero-copy { display:block; }
.hero-copy > * { opacity:0; translate:0 14px; transition:opacity .6s ease-out, translate .6s ease-out; }
.is-split .hero-copy > * { opacity:1; translate:0 0; }
.is-split .hero-copy > :nth-child(2) { transition-delay:.9s; }
.is-split .hero-copy > :nth-child(3) { transition-delay:1.1s; }
.hero-title { margin:0; font-size:clamp(40px,4.8vw,68px); font-weight:800; font-stretch:118%; letter-spacing:-0.015em; line-height:1.02; text-wrap:balance; }
.dw { display:inline-block; white-space:nowrap; }
.dc.is-bin { color:var(--spark); text-shadow:0 0 .3em rgba(245,130,32,.7); }
.hero-text { margin:20px 0 0; font-size:clamp(18px,1.6vw,21px); color:var(--mist); max-width:36ch; margin-inline:auto; }
.hero-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:12px 16px; margin-top:30px; }

@media (min-width:900px) {
  .hero.is-split { grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr); justify-items:start; align-items:center; }
  .is-split .hero-logo { --art:min(460px, 36vw, max(260px, calc((100svh - 200px) / 1.37))); width:var(--art); justify-self:center; }
  .is-split .hero-copy { text-align:left; }
  .is-split .hero-text { margin-inline:0; }
  .is-split .hero-actions { justify-content:flex-start; }
}
.no-trans, .no-trans * { transition:none !important; }
@media (prefers-reduced-motion: reduce) { .is-live .art-glow { animation:none; } }

/* Sections */
.section { padding-top: clamp(64px, 9vw, 128px); padding-bottom: clamp(64px, 9vw, 128px); }
.section-makes { border-top: 1px solid var(--rule); }
.section-how { background: var(--navy-deep); }
.section-about { background: var(--navy-raised); }
.section-contact { background: var(--navy-deep); padding-bottom: 56px; }

.section-head { display: flex; flex-wrap: wrap; gap: 24px 64px; align-items: end; justify-content: space-between; }
.section-head p { margin: 0; max-width: 44ch; color: var(--mist); }

/* What it makes */
.services {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 48px 56px; margin-top: 64px;
}
.service { border-top: 2px solid var(--spark); padding-top: 20px; }
.service h3 { margin-bottom: 8px; font-size: 24px; font-weight: 700; line-height: 1.2; }
.service p { margin: 0; color: var(--mist); }

/* How it's built */
.how-intro { margin: 24px 0 0; max-width: 58ch; color: var(--mist); }
.steps { position: relative; margin-top: 72px; padding-left: var(--rail); }
.spine { position: absolute; left: var(--spine); top: 8px; bottom: 8px; width: 2px; background: var(--spark); }
.loop {
  position: absolute; left: 0; top: 10px; bottom: 10px; width: var(--spine);
  border: 2px dashed rgba(245, 130, 32, 0.55); border-right: 0; border-radius: 14px 0 0 14px;
}
.steps-start { margin: 0 0 40px; font-size: 15px; color: var(--steel); }
.steps-end { margin: 0; font-size: 15px; color: var(--spark); font-weight: 600; }
.step-list { list-style: none; margin: 0; padding: 0; }
.step { position: relative; display: flex; flex-wrap: wrap; gap: 28px 56px; padding-bottom: 72px; }
.step:last-child { padding-bottom: 40px; }
.step-num {
  position: absolute; top: 0; left: calc(-1 * var(--rail) + var(--spine) - 15px);
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--spark); color: var(--navy-deep); font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.step-text { flex: 1 1 320px; min-width: 0; }
.step-text h3 { margin-bottom: 10px; font-size: 32px; font-weight: 800; font-stretch: 112%; line-height: 1.1; }
.step-text p { margin: 0; max-width: 42ch; color: var(--mist); }

.ex { flex: 1 1 380px; min-width: 0; border-radius: 4px; font-size: 15px; line-height: 1.55; }
.ex p { margin: 0 0 8px; }
.ex p:last-child { margin-bottom: 0; }
.ex-caption { font-size: 13px; }

.ex-scope { background: var(--ice); color: var(--navy); padding: 24px 28px; }
.ex-scope .ex-caption { margin-bottom: 14px; color: var(--ink-soft); }

.ex-concepts { border: 1.5px dashed var(--steel-dark); padding: 22px; }
.ex-title { margin-bottom: 14px; font-weight: 600; }
.concept-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.concept {
  aspect-ratio: 3 / 4; border: 1px solid var(--ink-soft); border-radius: 4px; padding: 8px;
  color: #6F89AE; font-weight: 800; display: flex; flex-direction: column; justify-content: space-between;
}
.concept.is-sent { border: 2px solid var(--spark); color: var(--ice); }
.concept-tag { font-size: 12px; font-weight: 700; color: var(--spark); }
.ex-concepts .ex-note { margin-top: 14px; color: var(--mist); }

.ex-log { background: var(--navy-raised); padding: 22px 26px; line-height: 1.6; }
.ex-log .ex-caption { margin-bottom: 12px; color: var(--steel); }
.log-title { margin-bottom: 4px !important; font-weight: 600; }
.log-text { margin-bottom: 14px !important; color: var(--mist); }
.ex-log .log-text:last-child { margin-bottom: 0 !important; }

.ex-bug { background: var(--ice); color: var(--navy); overflow: hidden; }
.bug-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  background: var(--spark); padding: 10px 20px; font-weight: 700;
}
.bug-body { padding: 18px 20px 20px; }
.bug-title { margin-bottom: 10px !important; font-weight: 700; font-size: 17px; }
.bug-body ol { margin: 0 0 12px; padding-left: 1.3em; }
.bug-body li { margin-bottom: 4px; }
.bug-foot { margin-top: 14px !important; padding-top: 12px; border-top: 1px solid var(--mist); color: var(--ink-soft); font-size: 13px; }

.ex-note-card { border: 1.5px solid var(--spark); padding: 22px 26px; line-height: 1.6; }
.ex-note-card .ex-caption { margin-bottom: 12px; color: var(--steel); }

/* Tools */
.tools { list-style: none; margin: 56px 0 0; padding: 0; border-bottom: 1px solid var(--rule); }
.tool {
  display: flex; flex-wrap: wrap; gap: 12px 48px; align-items: baseline;
  padding: 28px 0; border-top: 1px solid var(--rule);
}
.tool h3 { flex: 0 0 260px; font-size: 28px; font-weight: 800; font-stretch: 112%; line-height: 1.15; }
.tool p { flex: 1 1 360px; margin: 0; color: var(--mist); }
.tool-meta { display: flex; gap: 20px; align-items: baseline; font-weight: 600; }
.status { font-size: 14px; color: var(--navy); padding: 3px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.status-live { background: #7FD1A6; }
.status-inhouse { background: var(--steel); }
.status-progress { background: #F2B66B; }

/* About */
.about { display: flex; flex-wrap: wrap; gap: 48px 80px; }
.about h2 { flex: 1 1 380px; min-width: 0; }
.about-body { flex: 1 1 460px; min-width: 0; max-width: 62ch; }
.about-body > p { margin: 0 0 20px; }
.about-body > p:last-of-type { margin-bottom: 36px; }
.founder { border-top: 1px solid rgba(157, 183, 220, 0.3); padding-top: 28px; display: flex; gap: 20px; align-items: flex-start; }
.founder-photo { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.founder p { margin: 0 0 12px; }
.founder .founder-note { margin: 0; color: var(--mist); }

/* Contact */
.section-contact h2 { max-width: 18ch; }
.contact-text { margin: 24px 0 0; color: var(--mist); }
.contact-email {
  display: inline-block; margin-top: 28px;
  font-size: clamp(24px, 3.4vw, 44px); font-weight: 700; font-stretch: 108%;
  text-decoration-thickness: 2px; text-underline-offset: 8px; overflow-wrap: anywhere;
}
.contact-location { margin: 20px 0 0; color: var(--steel); font-size: 16px; }

.site-footer { background: var(--navy-deep); font-size: 14px; color: var(--steel); }
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px;
  padding-top: 24px; padding-bottom: 32px; border-top: 1px solid rgba(157, 183, 220, 0.2);
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .site-header { justify-content: center; }
  .nav { justify-content: center; gap: 4px 20px; }
  .tool h3 { flex-basis: 100%; }
  .step-text h3 { font-size: 28px; }
}

/* Patch 03: embers behind the page, the embers switch, headings that arrive hot */
.embers { position:fixed; inset:0; width:100%; height:100%; pointer-events:none; z-index:0; opacity:.9; }
:root[data-bg="off"] .embers, :root[data-motion="paused"] .embers { display:none; }
.site-header, main, .site-footer { position:relative; z-index:1; }
.section-how { background:rgba(7,25,52,.82); }
.section-about { background:rgba(14,40,77,.85); }
.section-contact, .site-footer { background:rgba(7,25,52,.82); }
.no-trans, .no-trans * { transition:none !important; }
[data-cool] { color:var(--spark-light); text-shadow:0 0 28px rgba(245,130,32,.6), 0 0 2px rgba(255,200,140,.6);
  transition:color 2.8s cubic-bezier(.4,0,.2,1) .45s, text-shadow 3.2s cubic-bezier(.4,0,.2,1) .45s; }
[data-cool].is-cool { color:var(--ice); text-shadow:0 0 0 rgba(245,130,32,0); }
:root[data-motion="paused"] .is-live .art-glow { animation:none; }
/* Visitor control for the embers (also pauses the other looping effects) */
.motion-toggle { position:fixed; right:16px; bottom:16px; z-index:4; display:flex; align-items:center; gap:8px;
  min-height:44px; min-width:44px; padding:0 12px; border-radius:999px; border:1px solid rgba(157,183,220,.25);
  background:rgba(7,25,52,.7); color:var(--steel); font:inherit; font-size:14px; cursor:pointer; backdrop-filter:blur(6px); }
.motion-toggle:hover { color:var(--ice); border-color:rgba(157,183,220,.5); }
.motion-toggle svg { width:18px; height:18px; flex:none; }
.motion-toggle .mt-text { max-width:0; overflow:hidden; white-space:nowrap; transition:max-width .3s; }
.motion-toggle:hover .mt-text, .motion-toggle:focus-visible .mt-text { max-width:120px; }
.motion-toggle[aria-pressed="true"] .flame { opacity:.35; }


/* Patch 04: molten metal runs down "How it's built" as you scroll */
.spine { position:absolute; left:var(--spine); top:8px; bottom:8px; width:2px; background:rgba(157,183,220,.22); }
.loop { position:absolute; left:0; top:10px; bottom:10px; width:var(--spine); border:2px dashed rgba(157,183,220,.28); border-right:0; border-radius:14px 0 0 14px; transition:border-color 1.2s, filter 1.2s; }
.steps.is-complete .loop { border-color:rgba(245,130,32,.75); filter:drop-shadow(0 0 6px rgba(245,130,32,.6)); }
.molten { position:absolute; left:calc(var(--spine) - 1px); top:8px; width:4px; height:0; border-radius:2px;
  background:linear-gradient(to bottom, #7A2E0C 0%, #C4540F 35%, #F58220 75%, #FFD9A0 100%);
  box-shadow:0 0 10px rgba(245,130,32,.55); }
.molten-head { position:absolute; left:50%; bottom:-7px; width:14px; height:14px; translate:-50% 0; border-radius:50%;
  background:radial-gradient(circle, #FFF6E6 0%, #FFD08A 35%, #F58220 70%, rgba(245,130,32,0) 100%);
  box-shadow:0 0 16px 6px rgba(245,130,32,.55); animation:flicker 1.3s ease-in-out infinite; }
.steps.is-complete .molten-head { opacity:0; transition:opacity .8s; }
@keyframes flicker { 0%,100% { scale:1; opacity:1; } 45% { scale:1.25; opacity:.85; } 70% { scale:.9; opacity:1; } }

.steps-end { color:var(--steel); transition:color 1.2s, text-shadow 1.2s; }
.steps.is-complete .steps-end { color:var(--spark); text-shadow:0 0 14px rgba(245,130,32,.5); }
.step-num { background:#16345E; color:var(--steel); border:2px solid rgba(157,183,220,.35); z-index:1;
  transition:background .5s, color .5s, border-color .5s, box-shadow .5s; }
.step.is-reached .step-num { background:var(--spark); color:var(--navy-deep); border-color:#FFC27A; box-shadow:0 0 0 4px rgba(245,130,32,.18), 0 0 18px rgba(245,130,32,.6); }
.step-text h3 { transition:color 2.4s cubic-bezier(.4,0,.2,1) .4s, text-shadow 2.8s cubic-bezier(.4,0,.2,1) .4s; }
.step.is-flare .step-text h3 { color:var(--spark-light); text-shadow:0 0 24px rgba(245,130,32,.65); transition:none; }
.steps .ember { position:absolute; z-index:2; translate:-50% -50%; border-radius:50%; background:#FFC27A; box-shadow:0 0 6px 2px rgba(245,130,32,.8); }
.steps.is-complete .molten-head { opacity:0; transition:opacity .8s; }
:root[data-motion="paused"] .molten-head { animation:none; }
@media (prefers-reduced-motion: reduce) { .molten-head { animation:none; } }

/* Patch 05: services poured into moulds */
/* What the foundry makes: a stream of 1s and 0s pours into each mould, fills it, then cools away completely */
.services { gap:28px; }
.mould { --mh:190px; position:relative; overflow:hidden; border:1.5px dashed rgba(157,183,220,.35); border-radius:6px; padding:22px 24px 26px; min-height:190px;
  transition:border-color 1.2s, background-color 1.6s; }
.mould-body { position:relative; z-index:2; opacity:0; transition:opacity .9s ease-out .9s; }
.mould h3 { margin:0 0 8px; font-size:23px; line-height:1.2; transition:color 2.4s cubic-bezier(.4,0,.2,1) .9s, text-shadow 2.8s cubic-bezier(.4,0,.2,1) .9s; }
.mould p { margin:0; color:var(--mist); }
.mould-fill { position:absolute; left:0; right:0; bottom:0; height:0; z-index:1; overflow:hidden;
  background:linear-gradient(to top, rgba(245,130,32,.30), rgba(245,130,32,.06));
  transition:height 1.1s cubic-bezier(.45,0,.25,1), opacity 1.4s ease-out .25s; }
.mould-fill::before { content:''; position:absolute; left:-10%; right:-10%; top:-6px; height:12px; z-index:1; border-radius:50%;
  background:radial-gradient(closest-side, rgba(255,230,190,.9), rgba(255,195,122,0)); transition:opacity 1s; }
.mould-bin { position:absolute; left:0; right:0; bottom:0; height:var(--mh); margin:0; padding:6px 8px;
  font:800 16px/19px 'Archivo', system-ui, sans-serif; letter-spacing:.16em; word-break:break-all; white-space:normal;
  color:#FFB36B; text-shadow:0 0 6px rgba(245,130,32,.85); }
.mould-pour { position:absolute; left:50%; top:0; height:100%; width:1.3em; translate:-50% 0; z-index:1; overflow:hidden;
  font:800 17px/17px 'Archivo', system-ui, sans-serif; color:#FFD9A8; text-align:center; text-shadow:0 0 8px rgba(245,130,32,.95);
  -webkit-mask-image:linear-gradient(transparent, #000 15%); mask-image:linear-gradient(transparent, #000 15%);
  opacity:0; transition:opacity .25s; }
.mould-pour span { display:block; white-space:pre; animation:fall .5s linear infinite; }
@keyframes fall { from { transform:translateY(-50%); } to { transform:translateY(0); } }
.mould.is-pouring .mould-pour { opacity:1; }
.mould:not(.is-pouring) .mould-fill::before { opacity:0; }
.mould.is-filled .mould-fill { height:100%; }
.mould.is-filled .mould-pour { opacity:0; transition-delay:.7s; }
.mould.is-cast { border-style:solid; border-color:rgba(245,130,32,.35); background-color:rgba(14,40,77,.55); }
.mould.is-cast .mould-fill { opacity:0; }
.mould.is-cast .mould-body { opacity:1; }
.mould.is-cast h3 { color:var(--ice); }
.mould.is-glow h3 { color:var(--spark-light); text-shadow:0 0 20px rgba(245,130,32,.6); transition:none; }
.mould.no-trans, .mould.no-trans * { transition:none !important; }
:root[data-motion="paused"] .mould-pour span { animation:none; }
@media (prefers-reduced-motion: reduce) { .mould-pour span { animation:none; } }
