/* ============================================================
   ourstages — Michael's portfolio
   Cool dark + signal green. Deliberately not the SaaS landing demo
   (warm dark, serif, amber) nor the B2B demo (light industrial, blue).
   Palette per brand/BRAND.md.
   ============================================================ */

:root {
  --bg:       #0e1115;
  --surface:  #161b21;
  --surface2: #1c222a;
  --line:     #262d36;
  --line2:    #38414c;
  --text:     #e9edf1;
  --muted:    #8d99a6;
  --dim:      #626d79;
  --acc:      #00c98d;
  --acc-dk:   #00a874;
  --acc-soft: rgba(0,201,141,.12);

  --f-head: "Archivo", "Noto Sans TC", system-ui, sans-serif;
  --f-body: "Noto Sans TC", "Archivo", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 1120px;
  --pad: clamp(1.15rem, 4vw, 2.5rem);
  --ease: cubic-bezier(.2,.6,.35,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
/* height:auto is load-bearing — without it the width/height attributes (kept for
   layout-shift reservation) win over the shrunk width and squash the image. */
img { max-width: 100%; height: auto; display: block; }

/* Anchor targets must clear the sticky header (its height + breathing room). */
:target, [id] { scroll-margin-top: 5.5rem; }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 3px;
}

h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 700; line-height: 1.12; letter-spacing: -.025em; }

.eyebrow {
  font-family: var(--f-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; color: var(--acc);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--f-body); font-weight: 600; font-size: .92rem;
  padding: .72em 1.4em; border: 1px solid transparent; border-radius: 4px;
  cursor: pointer; transition: background .2s, border-color .2s, color .2s, transform .2s var(--ease);
}
.btn-primary { background: var(--acc); color: #062017; }
.btn-primary:hover { background: var(--acc-dk); transform: translateY(-2px); }
.btn-ghost { border-color: var(--line2); color: var(--text); }
.btn-ghost:hover { border-color: var(--acc); color: var(--acc); transform: translateY(-2px); }
.btn-lg { padding: .9em 1.8em; font-size: 1rem; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14,17,21,.8); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-in { max-width: var(--maxw); margin: 0 auto; padding: .8rem var(--pad); display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); }
.mark { display: inline-flex; color: var(--text); }
.wm { font-family: var(--f-head); font-weight: 800; font-size: 1.18rem; letter-spacing: -.035em; }
.wm i { font-style: normal; color: var(--acc); }

.nav-menu { margin-left: auto; display: flex; align-items: center; gap: 1.7rem; }
.nav-menu > a:not(.btn) { font-size: .92rem; color: var(--muted); position: relative; }
.nav-menu > a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 1.5px; width: 0;
  background: var(--acc); transition: width .25s var(--ease);
}
.nav-menu > a:not(.btn):hover { color: var(--text); }
.nav-menu > a:not(.btn):hover::after { width: 100%; }
.nav-cta { padding: .5em 1.1em; font-size: .86rem; }

.nav-toggle {
  display: none; margin-left: auto; width: 40px; height: 34px; cursor: pointer;
  background: none; border: 1px solid var(--line2); border-radius: 4px;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px;
}
.nav-toggle span { display: block; width: 17px; height: 1.5px; background: var(--text); transition: transform .25s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: absolute; top: 100%; left: 0; right: 0; display: none;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: .4rem var(--pad) 1.1rem;
  }
  .nav-menu.open { display: flex; }
  .nav-menu > a:not(.btn) { padding: .85rem 0; border-bottom: 1px solid var(--line); }
  .nav-cta { margin-top: .9rem; }
}

/* ---------- hero ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3.5rem, 10vw, 7rem) var(--pad) clamp(2.5rem, 6vw, 4rem);
  position: relative;
  /* Clip the glow to the hero. It sits at right:-10%, which on a 390px
     viewport pushes the page 39px wider — body{overflow-x:hidden} hides that
     visually but the document still scrolls sideways. Clipping here instead of
     on html/body keeps the sticky nav working. */
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; top: -10%; right: -10%;
  width: 620px; height: 620px; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, var(--acc-soft), transparent 62%);
  filter: blur(30px);
}
.hero-in { max-width: 860px; }
h1 { font-size: clamp(2.4rem, 6.5vw, 4.4rem); margin: 1.1rem 0 1.5rem; }
h1 em { font-style: normal; color: var(--acc); }
.lede { font-size: clamp(1.02rem, 1.5vw, 1.18rem); color: var(--muted); max-width: 46em; }
.hero-note {
  margin-top: 1.1rem; padding-left: 1rem; border-left: 2px solid var(--acc);
  font-size: .88rem; color: var(--dim); max-width: 52em;
}
.hero-actions { display: flex; gap: .8rem; margin: 2.2rem 0 2.6rem; flex-wrap: wrap; }

.facts { display: flex; gap: 2.5rem; flex-wrap: wrap; padding-top: 1.8rem; border-top: 1px solid var(--line); }
.fact { display: flex; flex-direction: column; }
.fact b { font-family: var(--f-head); font-size: 1.05rem; font-weight: 700; }
.fact span { font-size: .82rem; color: var(--dim); }

/* ---------- sections ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(3.5rem, 8vw, 6.5rem) var(--pad); }
.band {
  max-width: none; background: var(--surface); border-block: 1px solid var(--line);
  padding-inline: max(var(--pad), calc((100% - var(--maxw)) / 2 + var(--pad)));
}
.sec-head { max-width: 760px; margin-bottom: clamp(2.2rem, 5vw, 3.5rem); }
.sec-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-top: .9rem; }
.sec-lede { color: var(--muted); margin-top: 1rem; font-size: .98rem; }
.why-h { white-space: pre-line; }

/* ---------- work ---------- */
.works { display: flex; flex-direction: column; gap: clamp(1.5rem, 3vw, 2.2rem); }
.work {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; transition: border-color .3s;
}
.work:hover { border-color: var(--line2); }
.work:nth-child(even) .work-shot { order: 2; }
.work-shot { background: var(--surface2); display: grid; place-items: center; padding: 1.6rem; overflow: hidden; }
.work-shot img {
  border-radius: 4px; border: 1px solid var(--line);
  box-shadow: 0 20px 44px -22px rgba(0,0,0,.8);
  transition: transform .5s var(--ease);
}
.work:hover .work-shot img { transform: scale(1.02); }
.work-body { padding: clamp(1.5rem, 3vw, 2.2rem); display: flex; flex-direction: column; align-items: flex-start; }
.work-top { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .9rem; }
.tag {
  font-family: var(--f-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--acc); background: var(--acc-soft); padding: .3em .65em; border-radius: 3px;
}
.proves { font-family: var(--f-mono); font-size: .68rem; color: var(--dim); }
.work h3 { font-size: 1.5rem; }
.work-sub { font-family: var(--f-mono); font-size: .74rem; color: var(--dim); margin: .3rem 0 1rem; }
.work-problem { font-size: .89rem; color: var(--dim); margin-bottom: .7rem; }
.work-problem b {
  font-family: var(--f-mono); font-size: .66rem; letter-spacing: .12em;
  color: var(--acc); margin-right: .6em; text-transform: uppercase;
}
.work-desc { color: var(--muted); font-size: .93rem; margin-bottom: 1.1rem; }
.points { list-style: none; display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1.4rem; }
.points li { position: relative; padding-left: 1.5rem; font-size: .87rem; color: var(--muted); line-height: 1.65; }
.points li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--acc);
}
.work-note { font-size: .78rem; color: var(--dim); font-style: italic; }

/* Native <details> — keyboard- and no-JS-operable for free. */
.work-details { width: 100%; margin: -.4rem 0 1.3rem; }
.work-details summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em;
  color: var(--dim); padding: .35em 0; transition: color .2s;
}
.work-details summary::-webkit-details-marker { display: none; }
.work-details summary::before {
  content: "+"; display: inline-grid; place-items: center;
  width: 15px; height: 15px; border: 1px solid var(--line2); border-radius: 3px;
  font-size: .8rem; line-height: 1; color: var(--acc);
}
.work-details[open] summary::before { content: "–"; }
.work-details summary:hover { color: var(--text); }
.work-details .points { margin: .8rem 0 0; }
.points-tight li { font-size: .82rem; }

.cms-note {
  margin-top: clamp(1.5rem, 3vw, 2.2rem);
  background: linear-gradient(180deg, var(--acc-soft), transparent);
  border: 1px solid rgba(0,201,141,.22); border-radius: 8px;
  padding: clamp(1.5rem, 3vw, 2rem);
}
.cms-note h3 { font-size: 1.2rem; margin-bottom: .6rem; }
.cms-note p { color: var(--muted); font-size: .92rem; max-width: 70ch; }

/* ---------- services ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.svc {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 1.8rem 1.6rem; transition: border-color .3s;
}
.svc:hover { border-color: var(--line2); }
.svc h3 { font-size: 1.15rem; }
.svc-desc {
  font-size: .84rem; color: var(--dim); margin: .5rem 0 1.1rem;
  padding-bottom: 1.1rem; border-bottom: 1px solid var(--line);
  /* Two lines' worth, so the rule and the tick lists line up across all three
     cards even though one blurb is shorter than the others. content-box so the
     reservation is text height only — the global border-box would eat it into
     the padding and leave the cards 19px out of step. */
  box-sizing: content-box;
  min-height: calc(2 * 1.75em);
}
.svc-footnote { margin-top: 1.4rem; font-size: .84rem; color: var(--dim); }
.ticks { list-style: none; display: flex; flex-direction: column; gap: .6rem; }
.ticks li { position: relative; padding-left: 1.6rem; font-size: .9rem; color: var(--muted); }
.ticks li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--acc); font-size: .8rem; font-weight: 700;
}
.pay {
  margin-top: 1.4rem; border: 1px dashed var(--line2); border-radius: 8px;
  padding: 1.4rem 1.6rem;
}
.pay h4 { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: .6rem; font-weight: 500; }
.pay p { color: var(--muted); font-size: .89rem; max-width: 78ch; }

/* ---------- why ---------- */
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.why-item { background: var(--bg); padding: 1.8rem 1.5rem; }
.why-n { font-family: var(--f-mono); font-size: .74rem; color: var(--acc); letter-spacing: .1em; }
.why-item h3 { font-size: 1.05rem; margin: .6rem 0 .5rem; }
.why-item p { font-size: .87rem; color: var(--muted); }

/* ---------- contact ---------- */
.contact {
  max-width: none; text-align: center;
  padding: clamp(4rem, 9vw, 7rem) var(--pad);
  background-image: radial-gradient(60% 70% at 50% 0%, var(--acc-soft), transparent 65%);
  border-top: 1px solid var(--line);
}
.contact h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); margin-top: 1rem; }
.contact-lede { color: var(--muted); margin: 1.1rem auto 2.2rem; max-width: 40em; }
.contact-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.contact-note { margin-top: 1.6rem; font-family: var(--f-mono); font-size: .76rem; color: var(--dim); }

/* ---------- 404 ---------- */
.notfound {
  max-width: var(--maxw); margin: 0 auto; text-align: center;
  padding: clamp(5rem, 14vw, 9rem) var(--pad);
  min-height: 58vh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  background-image: radial-gradient(60% 70% at 50% 20%, var(--acc-soft), transparent 65%);
}
.notfound h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 1rem 0 1.2rem; }
.notfound-lede { color: var(--muted); max-width: 42em; margin-bottom: 2.2rem; }
.notfound-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-in {
  max-width: var(--maxw); margin: 0 auto; padding: clamp(2.2rem, 5vw, 3rem) var(--pad) 1.6rem;
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; align-items: flex-start;
}
.footer-brand { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.footer-brand p { width: 100%; color: var(--dim); font-size: .84rem; margin-top: .4rem; }
.footer-note { color: var(--dim); font-size: .78rem; max-width: 34ch; text-align: right; }
.footer-base {
  max-width: var(--maxw); margin: 0 auto; padding: 1.1rem var(--pad);
  border-top: 1px solid var(--line); font-size: .78rem; color: var(--dim);
}

/* ---------- reveal (progressive enhancement) ---------- */
.js .reveal, .js .reveal-up { opacity: 0; }
.reveal { transform: translateY(12px); animation: rise .8s var(--ease) forwards; }
.reveal[data-delay="1"]{ animation-delay: .08s; } .reveal[data-delay="2"]{ animation-delay: .16s; }
.reveal[data-delay="3"]{ animation-delay: .24s; } .reveal[data-delay="4"]{ animation-delay: .32s; }
.reveal-up { transform: translateY(22px); }
.reveal-up.in { animation: rise .7s var(--ease) forwards; }
.reveal-up.in[data-delay="1"]{ animation-delay: .09s; } .reveal-up.in[data-delay="2"]{ animation-delay: .18s; }
.reveal-up.in[data-delay="3"]{ animation-delay: .27s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .why-grid { grid-template-columns: 1fr 1fr; }
  .svc-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .work { grid-template-columns: 1fr; }
  .work:nth-child(even) .work-shot { order: 0; }
  .svc-grid { grid-template-columns: 1fr; }
  .footer-note { text-align: left; }
}
@media (max-width: 560px) {
  .why-grid { grid-template-columns: 1fr; }
  .facts { gap: 1.4rem; }
  .hero-actions .btn, .contact-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .js .reveal, .js .reveal-up { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
  .work:hover .work-shot img { transform: none; }
}
