/* =========================================================
   Projects page — builds on the tokens in styles.css
   ========================================================= */

.projects-page { min-height: 100vh; display: flex; flex-direction: column; }
html.runner-open, html.runner-open body { overflow: hidden; }

/* quiet version of the homepage nebula: the demos do the talking here */
.pj-sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 12% -10%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(50rem 36rem at 95% 8%, oklch(45% .12 250 / .22), transparent 70%),
    radial-gradient(70rem 30rem at 50% 115%, color-mix(in oklab, var(--primary) 9%, transparent), transparent 70%),
    var(--canvas-bg);
}

.pj-topbar { z-index: 20; }
.brand { color: var(--foreground); }
.pj-nav { display: flex; gap: 1.25rem; }
.pj-nav a[aria-current="page"] { color: var(--foreground); }
@media (min-width: 768px) { .pj-nav { gap: 2rem; } }

.pj-main {
  position: relative; z-index: 10; flex: 1;
  width: 100%; max-width: 88rem; margin-inline: auto;
  padding: 1rem 1.5rem 6rem;
  outline: none;
}
@media (min-width: 768px) { .pj-main { padding: 1.5rem 3rem 7rem; } }
.pj-noscript { color: var(--muted-foreground); padding: 4rem 0; }

:where(.pj-main) a:focus-visible,
:where(.pj-main, .runner) button:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 10px;
}
.ico { width: 1.15em; height: 1.15em; flex-shrink: 0; }

/* =========================================================
   INDEX
   ========================================================= */
.pj-index { max-width: 76rem; margin-inline: auto; }

.pj-intro { padding: 4.5rem 0 2.5rem; max-width: 46rem; }
.pj-title {
  font-family: var(--font-serif); font-weight: 300;
  font-size: clamp(4rem, 11vw, 8.5rem); line-height: .86; letter-spacing: -0.035em;
}
.pj-lede {
  margin-top: 1.75rem; max-width: 36rem;
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.5;
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.pj-group { margin-top: 4rem; }
.pj-group-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid color-mix(in oklab, var(--foreground) 14%, transparent);
}
.pj-group-head h2 { font-size: 1rem; font-weight: 600; letter-spacing: .01em; }
.pj-group-head p { font-size: .9rem; color: var(--muted-foreground); }

.pj-cards { display: grid; gap: 3rem 2.25rem; margin-top: 2rem; }
@media (min-width: 760px) {
  .pj-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* an odd card out spans the row, with its text beside the demo */
  .pj-cards > .pj-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, .62fr); align-items: center; gap: 2.5rem;
  }
  .pj-cards > .pj-card:last-child:nth-child(odd) .pj-card-stage { height: 22rem; }
}

.pj-card { display: flex; flex-direction: column; gap: 1.15rem; }
.pj-card-stage {
  position: relative; height: 19rem;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem 1.25rem 1.75rem;
  border-radius: 1.5rem;
  border: 1px solid color-mix(in oklab, var(--foreground) 9%, transparent);
  background:
    radial-gradient(ellipse 60% 45% at 50% 100%, color-mix(in oklab, var(--primary) 13%, transparent), transparent 70%),
    radial-gradient(ellipse 70% 60% at 50% 30%, color-mix(in oklab, var(--accent) 11%, transparent), transparent 75%),
    color-mix(in oklab, var(--background) 55%, transparent);
  overflow: hidden;
  transition: border-color .25s ease;
}
.pj-card-stage[data-kind="phone"] { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.pj-card:hover .pj-card-stage { border-color: color-mix(in oklab, var(--primary) 38%, transparent); }
.pj-card-text { display: flex; flex-direction: column; gap: .35rem; padding: 0 .25rem; }
.pj-card-kind { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted-foreground); }
.pj-card-name {
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(1.6rem, 2.4vw, 2rem); line-height: 1.05; letter-spacing: -0.01em;
  transition: color .2s ease;
}
.pj-card:hover .pj-card-name { color: var(--primary); }
.pj-card-tag { font-size: .93rem; line-height: 1.55; color: var(--muted-foreground); max-width: 34rem; }
.pj-card-more { display: inline-flex; align-items: center; gap: .3rem; margin-top: .35rem; font-size: .85rem; font-weight: 500; color: var(--primary); }
.pj-card-more .ico { transition: transform .2s ease; }
.pj-card:hover .pj-card-more .ico { transform: translateX(3px); }
@media (max-width: 599px) {
  .pj-intro { padding: 2.5rem 0 1rem; }
  .pj-card-stage { height: 16.5rem; padding: 1rem; }
}

/* =========================================================
   DETAIL
   ========================================================= */
.pj-crumbs {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem 0 1.25rem;
  font-size: .875rem; color: var(--muted-foreground);
}
.pj-crumbs a { display: inline-flex; align-items: center; gap: .4rem; transition: color .2s ease; }
.pj-crumbs a:hover { color: var(--foreground); }
.pj-pager { display: inline-flex; align-items: center; gap: .35rem; }
.pj-pager a {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--foreground) 14%, transparent);
}
.pj-pager a:hover { border-color: color-mix(in oklab, var(--primary) 50%, transparent); color: var(--primary); }
.pj-count { font-family: var(--font-mono); font-size: 11.5px; min-width: 4.5rem; text-align: center; }

.pj-split { display: grid; gap: 2.5rem; }
@media (min-width: 960px) {
  .pj-split { grid-template-columns: minmax(0, 1.45fr) minmax(22rem, 1fr); gap: 3.5rem; align-items: start; }
  .pj-detail[data-kind="phone"] .pj-split { grid-template-columns: minmax(0, 1fr) minmax(24rem, 1.05fr); }
  .pj-detail[data-kind="panel"] .pj-split { grid-template-columns: minmax(0, 1.2fr) minmax(24rem, 1fr); }
}

/* ---------- the stage: a lit plinth the device stands on ---------- */
.pj-stage {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: 2rem;
  border: 1px solid color-mix(in oklab, var(--foreground) 9%, transparent);
  background:
    radial-gradient(ellipse 55% 40% at 50% 92%, color-mix(in oklab, var(--primary) 15%, transparent), transparent 70%),
    radial-gradient(ellipse 70% 60% at 50% 35%, color-mix(in oklab, var(--accent) 12%, transparent), transparent 75%),
    color-mix(in oklab, var(--background) 55%, transparent);
  overflow: hidden;
}
.pj-stage-dev {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.pj-stage[data-kind="desktop"] .pj-stage-dev,
.pj-stage[data-kind="panel"] .pj-stage-dev { padding: 2.5rem 2rem 2.25rem; }
@media (min-width: 960px) {
  .pj-stage { position: sticky; top: 1.25rem; }
  /* the phone is sized to the window so the whole handset is visible without scrolling */
  .pj-stage[data-kind="phone"] { height: calc(100vh - 11rem); min-height: 34rem; max-height: 62rem; }
}
@media (max-width: 959px) {
  .pj-stage-dev { padding: 1.5rem 1rem; }
}

.pj-fit { position: relative; flex-shrink: 0; }
.pj-fit > * { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.pj-fit::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -14px; height: 28px; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .65), transparent 70%);
  filter: blur(6px);
}
iframe[data-demo] { pointer-events: none; }

/* ---------- step captions under a demo ---------- */
.pj-cap {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .6rem 1rem;
  padding: .95rem 1.1rem 1rem 1.25rem;
  border-top: 1px solid color-mix(in oklab, var(--foreground) 9%, transparent);
  background: color-mix(in oklab, var(--background) 45%, transparent);
}
.pj-cap-main { display: flex; align-items: baseline; gap: .75rem; min-width: 0; min-height: 2.9rem; }
.pj-cap-n { font-family: var(--font-mono); font-size: 11.5px; color: var(--primary); flex-shrink: 0; }
.pj-cap-text { font-size: .95rem; line-height: 1.5; color: var(--foreground); text-wrap: pretty; }
.pj-cap-dots { grid-column: 1; grid-row: 2; display: flex; gap: .35rem; }
.pj-cap-dots i { width: 1.5rem; height: 3px; border-radius: 3px; background: color-mix(in oklab, var(--foreground) 16%, transparent); transition: background .3s ease; }
.pj-cap-dots i.done { background: color-mix(in oklab, var(--primary) 55%, transparent); }
.pj-cap-dots i.on { background: var(--primary); }
.pj-cap-ctrl { grid-column: 2; grid-row: 1 / 3; display: flex; gap: .4rem; }
.pj-icon-btn {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--foreground) 16%, transparent);
  background: transparent; color: var(--foreground); cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.pj-icon-btn:hover { background: color-mix(in oklab, var(--foreground) 8%, transparent); border-color: color-mix(in oklab, var(--primary) 45%, transparent); }
.pj-icon-btn .ico { width: 1.05rem; height: 1.05rem; }
.pj-cap.is-live { display: block; }
.pj-cap.is-live .pj-cap-text { color: var(--muted-foreground); font-size: .9rem; }

/* ---------- iPhone ---------- */
.iphone {
  width: 417px; height: 876px; padding: 4px;
  border-radius: 68px;
  background: linear-gradient(135deg, #8d8f97 0%, #3b3d44 18%, #2a2c32 50%, #4a4c53 82%, #9a9ca4 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .08) inset,
    0 40px 80px -20px rgba(0, 0, 0, .7),
    0 18px 36px -18px rgba(0, 0, 0, .6);
}
.ip-btn { position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #5a5c63, #2f3036); }
.ip-action { left: -3px; top: 150px; height: 34px; }
.ip-vol-up { left: -3px; top: 212px; height: 64px; }
.ip-vol-down { left: -3px; top: 290px; height: 64px; }
.ip-power { right: -3px; top: 238px; height: 104px; background: linear-gradient(270deg, #5a5c63, #2f3036); }
.ip-bezel { width: 100%; height: 100%; padding: 8px; border-radius: 64px; background: #050506; }
.ip-screen {
  position: relative; width: 393px; height: 852px; overflow: hidden;
  border-radius: 56px; background: var(--app-bg, #000);
  isolation: isolate;
}
.ip-status {
  position: absolute; top: 0; left: 0; right: 0; height: 54px; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 30px 0 52px;
  background: var(--app-bg, #000);
  font: 600 16.5px/1 var(--font-sans); letter-spacing: -.01em;
  color: #fff;
}
.ip-status.is-dark { color: #000; }
.ip-icons { display: inline-flex; align-items: center; gap: 6px; }
.ip-icons svg { fill: currentColor; }
.ip-island {
  position: absolute; z-index: 4; top: 11px; left: 50%; transform: translateX(-50%);
  width: 124px; height: 36px; border-radius: 20px; background: #000;
}
.ip-app {
  position: absolute; top: 54px; left: 0; width: 393px; height: 798px;
  border: 0; display: block; background: var(--app-bg, #000);
  opacity: 0; transition: opacity .35s ease;
}
.ip-home {
  position: absolute; z-index: 4; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 138px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .72);
  pointer-events: none;
}
iframe.is-loaded { opacity: 1; }

/* ---------- monitor + browser ---------- */
.monitor { width: 992px; height: 762px; }
.mon-display {
  position: relative; width: 992px; height: 684px;
  padding: 16px 16px 30px;
  border-radius: 20px;
  background: linear-gradient(180deg, #17181d, #0c0d10);
  box-shadow:
    0 0 0 1.5px #2f3138 inset,
    0 0 0 1px rgba(255, 255, 255, .05),
    0 50px 90px -30px rgba(0, 0, 0, .75);
}
.mon-cam {
  position: absolute; top: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: #2c2f38;
}
.mon-browser { width: 960px; height: 638px; border-radius: 8px; overflow: hidden; background: #0d0f17; display: flex; flex-direction: column; }
.mon-bar {
  height: 38px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: #1c1e26; border-bottom: 1px solid #262934;
}
.mon-dots { display: inline-flex; gap: 8px; }
.mon-dots i { width: 12px; height: 12px; border-radius: 50%; background: #3a3d48; }
.mon-dots i:nth-child(1) { background: #ff5f57; }
.mon-dots i:nth-child(2) { background: #febc2e; }
.mon-dots i:nth-child(3) { background: #28c840; }
.mon-url {
  flex: 1; max-width: 520px; margin: 0 auto; height: 26px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 8px; background: #272a34;
  font: 500 13px/1 var(--font-sans); color: #c5c8d4;
}
.mon-lock { width: 13px; height: 13px; color: #8f94a6; }
.mon-spacer { width: 52px; }
.mon-view { position: relative; flex: 1; background: #0d0f17; }
.mon-app { position: absolute; inset: 0; width: 960px; height: 600px; border: 0; display: block; opacity: 0; transition: opacity .35s ease; }
.mon-neck {
  width: 160px; height: 64px; margin: 0 auto;
  background: linear-gradient(90deg, #1b1c21, #34363d 50%, #1b1c21);
  clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
}
.mon-foot {
  width: 310px; height: 14px; margin: 0 auto;
  border-radius: 3px 3px 12px 12px;
  background: linear-gradient(180deg, #3a3c43, #1a1b20);
}

/* ---------- panel (how-it-works demos) ---------- */
.panelf {
  width: 640px; height: 480px; overflow: hidden;
  border-radius: 22px;
  border: 1px solid color-mix(in oklab, var(--foreground) 14%, transparent);
  background: #0c0e1a;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .75);
}
.panel-app { width: 640px; height: 480px; border: 0; display: block; opacity: 0; transition: opacity .35s ease; }

/* ---------- write-up ---------- */
.pj-copy { max-width: 38rem; }
.pj-kind { font-family: var(--font-mono); font-size: 12px; color: var(--primary); }
.pj-kind span { color: var(--muted-foreground); margin-left: .5rem; }
.pj-name {
  margin-top: .6rem;
  font-family: var(--font-serif); font-weight: 300;
  font-size: clamp(2.8rem, 5vw, 4.25rem); line-height: .98; letter-spacing: -0.025em;
}
.pj-tagline {
  margin-top: 1rem;
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.3rem; line-height: 1.5; color: var(--muted-foreground);
  text-wrap: pretty;
}
.pj-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.pj-actions .btn { gap: .5rem; }
.pj-hint { margin-top: .75rem; font-size: .85rem; line-height: 1.55; color: var(--muted-foreground); }
.pj-note {
  margin-top: 1.25rem; padding: .8rem 1rem; border-radius: .9rem;
  font-size: .875rem; line-height: 1.55; color: color-mix(in oklab, var(--foreground) 80%, transparent);
  background: color-mix(in oklab, var(--primary) 7%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 22%, transparent);
}
.pj-sec { margin-top: 2.75rem; }
.pj-sec h2 { font-family: var(--font-serif); font-weight: 500; font-size: 1.65rem; line-height: 1.2; margin-bottom: .9rem; }
.pj-sec p { font-size: 1rem; line-height: 1.75; color: color-mix(in oklab, var(--foreground) 80%, transparent); }
.pj-sec p + p { margin-top: 1rem; }

.pj-stack { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.pj-stack li {
  padding: .35rem .75rem; border-radius: var(--radius-pill);
  font-size: .8rem; color: color-mix(in oklab, var(--foreground) 82%, transparent);
  background: color-mix(in oklab, var(--foreground) 5%, transparent);
  border: 1px solid color-mix(in oklab, var(--foreground) 10%, transparent);
}

.pj-skills { display: grid; gap: 1.1rem; }
.pj-skills div { padding-left: 1rem; border-left: 2px solid color-mix(in oklab, var(--primary) 45%, transparent); }
.pj-skills dt { font-weight: 600; font-size: .98rem; }
.pj-skills dd { margin-top: .2rem; font-size: .92rem; line-height: 1.6; color: var(--muted-foreground); }

.pj-next {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .15rem 1rem;
  margin-top: 3.5rem; padding: 1.25rem 1.4rem;
  border-radius: 1.1rem;
  border: 1px solid color-mix(in oklab, var(--foreground) 12%, transparent);
  transition: border-color .2s ease, background-color .2s ease;
}
.pj-next span { font-size: .8rem; color: var(--muted-foreground); }
.pj-next b { grid-row: 2; font-family: var(--font-serif); font-weight: 500; font-size: 1.6rem; line-height: 1.1; }
.pj-next .ico { grid-row: 1 / 3; grid-column: 2; width: 1.4rem; height: 1.4rem; color: var(--muted-foreground); }
.pj-next:hover { border-color: color-mix(in oklab, var(--primary) 45%, transparent); background: color-mix(in oklab, var(--primary) 5%, transparent); }
.pj-next:hover .ico { color: var(--primary); }
@media (max-width: 959px) { .pj-copy { max-width: 42rem; } }

/* =========================================================
   RUNNER — the full game, full screen, still on this page
   ========================================================= */
.runner {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: rgb(6, 4, 18);
}
.runner[hidden] { display: none; }
.runner-bar {
  display: flex; align-items: center; gap: .6rem;
  height: 3.25rem; padding: 0 .75rem 0 1.25rem;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  border-bottom: 1px solid color-mix(in oklab, var(--foreground) 10%, transparent);
}
.runner-id { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: .75rem; }
.runner-title { font-family: var(--font-serif); font-size: 1.3rem; white-space: nowrap; }
.runner-host { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.runner-btn {
  height: 2.2rem; padding: 0 .95rem; border-radius: var(--radius-pill);
  border: 1px solid color-mix(in oklab, var(--foreground) 16%, transparent);
  background: transparent; color: var(--foreground); font-size: .85rem; font-weight: 500; cursor: pointer;
}
.runner-btn:hover { background: color-mix(in oklab, var(--foreground) 8%, transparent); }
.runner-close { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.runner-close:hover { background: var(--primary); opacity: .9; }
.runner-body { position: relative; flex: 1; display: flex; justify-content: center; min-height: 0; }
.runner-frame { position: relative; width: 100%; height: 100%; }
.runner-app { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; opacity: 0; transition: opacity .3s ease; }
@media (max-width: 599px) {
  .runner-host { display: none; }
  .runner-bar { padding-left: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ip-app, .mon-app, .panel-app, .runner-app, .pj-card-stage, .pj-card-name, .pj-card-more .ico { transition: none; }
}
