/* ──────────────────────────────────────────────────────────────────────
   PCS Studios · PureCommonSense — website design
   The studio page the demos lay on. Confident but recessive: the demos
   are the portfolio, so the chrome stays dark, spacious and rational —
   pure common sense — and lets the bright thumbnails carry the color.
   ────────────────────────────────────────────────────────────────────── */

:root {
  --void:      #0a0b0d;
  --surface:   #131519;
  --surface-2: #191c22;
  --line:      rgba(255,255,255,0.09);
  --line-mid:  rgba(255,255,255,0.16);
  --ink:       #e9eaee;
  --ink-dim:   #9aa0aa;
  --ink-faint: #676d77;
  --pick:      #7ee0b8;
  --pick-dim:  rgba(126,224,184,0.14);
  --radius:    10px;
  --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --serif:     ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only UA-stylesheet strength; any author rule
   that sets `display` silently defeats it. This makes hidden mean hidden. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; }

/* ── Header ───────────────────────────────────────────────────────────── */

.head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(20px, 5vw, 56px);
  background: rgba(10,11,13,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark { width: 30px; height: 30px; display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
}
.brand-text i {
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.head-nav { display: flex; gap: clamp(16px, 2.6vw, 34px); }
.head-nav a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.head-nav a:hover { color: var(--pick); }

/* ── Hero ─────────────────────────────────────────────────────────────── */

.gallery { padding: 0 0 0; }

.hero {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(48px, 7vw, 100px) clamp(20px, 5vw, 56px) clamp(30px, 4vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
}

/* a blinking caret closes the headline — the studio is mid-keystroke */
.caret {
  display: inline-block;
  width: 0.09em;
  height: 0.82em;
  margin-left: 0.08em;
  background: var(--pick);
  vertical-align: -0.06em;
  animation: caretblink 1.1s steps(1) infinite;
}
@keyframes caretblink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.overline {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 26px;
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.overline::before { content: ""; width: 30px; height: 2px; background: var(--pick); }

.hero h1 {
  margin: 0 0 26px;
  font-size: clamp(38px, 6.6vw, 92px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  max-width: 16ch;
}
.hero h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--pick);
  letter-spacing: -0.02em;
}

.hero-lede {
  margin: 0 0 40px;
  max-width: 62ch;
  font-size: clamp(15px, 1.3vw, 17px);
  line-height: 1.7;
  color: var(--ink-dim);
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: clamp(16px, 3vw, 44px);
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.hero-meta b {
  display: block;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--pick);
  font-variant-numeric: tabular-nums;
  margin-bottom: 5px;
}
.hero-meta span {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-faint);
  display: block;
}

/* ── The dev scene: code types, the site builds itself ────────────────── */

.devscene {
  position: relative;
  min-height: 380px;
}
.win-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.win-bar i { width: 9px; height: 9px; border-radius: 50%; background: #3a4048; }
.win-bar span {
  margin-left: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.win-bar.browser .url {
  flex: 1;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--void);
  border: 1px solid var(--line);
  color: var(--pick);
}

.editor {
  position: absolute;
  top: 0; left: 0;
  width: 72%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
.code {
  margin: 0;
  padding: 14px 16px 16px 40px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(10.5px, 0.9vw, 12.5px);
  line-height: 1.9;
  color: var(--ink-dim);
  counter-reset: ln;
}
.code li { list-style: none; position: relative; white-space: nowrap; }
.code li::before {
  counter-increment: ln;
  content: counter(ln);
  position: absolute;
  left: -26px;
  color: var(--ink-faint);
  opacity: 0.55;
  font-size: 0.85em;
}
.code .tg { color: var(--pick); }
.code .at { color: #e0b56a; }
.code .st { color: #d9905f; }
.code .tx { color: var(--ink); }
.code .cm { color: var(--ink-faint); font-style: italic; }
/* while building, lines exist but haven't been typed yet */
.devscene.building .code li { visibility: hidden; }
.devscene.building .code li.on { visibility: visible; }
.code li.is-caret::after {
  content: "▍";
  color: var(--pick);
  animation: caretblink 0.9s steps(1) infinite;
}

.minisite {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 58%;
  border: 1px solid var(--line-mid);
  border-radius: 10px;
  background: #fdfcf9;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0,0,0,0.55);
}
.ms-body { position: relative; padding: 14px 16px 16px; }
.ms-el {
  opacity: 1;
  transform: none;
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}
.devscene.building .ms-el { opacity: 0; transform: translateY(7px); }
.devscene.building .ms-el.on { opacity: 1; transform: translateY(0); }
.ms-cards .ms-el:nth-child(2) { transition-delay: 130ms; }
.ms-cards .ms-el:nth-child(3) { transition-delay: 260ms; }

.ms-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8e4da;
  margin-bottom: 12px;
}
.ms-nav b { width: 26px; height: 9px; border-radius: 3px; background: #1d2333; }
.ms-nav u { width: 18px; height: 5px; border-radius: 3px; background: #c9c4b8; margin-left: auto; }
.ms-nav u:last-child { margin-left: 0; }
.ms-h1 {
  font-weight: 800;
  font-size: clamp(13px, 1.2vw, 17px);
  letter-spacing: -0.02em;
  color: #1d2333;
  margin-bottom: 7px;
}
.ms-p { width: 70%; height: 6px; border-radius: 3px; background: #ddd8cc; margin-bottom: 14px; }
.ms-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.ms-card {
  height: 44px;
  border-radius: 6px;
  border: 1px solid #e2ddd2;
  background:
    linear-gradient(180deg, #eef2e6 0 55%, transparent 55%),
    #f7f4ec;
}
.ms-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 100px;
  background: #1d2333;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.ms-live {
  position: absolute;
  top: 12px;
  right: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #0d8a5f;
  font-weight: 700;
}

.storage-note {
  margin: 26px 0 0;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--ink-faint);
  border-radius: 0 6px 6px 0;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-dim);
  max-width: 62ch;
}

/* ── Work / gallery ───────────────────────────────────────────────────── */

.work {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 40px) clamp(20px, 5vw, 56px) clamp(50px, 6vw, 90px);
}

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.work-head h2 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.025em;
}
.work-head p { margin: 0; font-size: 13px; color: var(--ink-faint); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(16px, 2vw, 26px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: inherit;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease);
}

.card:hover,
.card:focus-visible {
  border-color: var(--line-mid);
  transform: translateY(-3px);
  outline: none;
}
.card:focus-visible { box-shadow: 0 0 0 2px var(--pick); }

.card.is-chosen { border-color: var(--pick); }

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.thumb iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  transform-origin: 0 0;
  transform: scale(var(--thumb-scale, 0.25));
  pointer-events: none;
}

/* hairline veil so seven bright demos read as one set; lifts on hover */
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10,11,13,0.14);
  transition: background 180ms var(--ease);
}
.card:hover .thumb::after { background: rgba(10,11,13,0); }

/* hover invitation */
.thumb::before {
  content: "Open the demo →";
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  padding: 6px 12px;
  border-radius: 100px;
  background: rgba(10,11,13,0.88);
  color: var(--pick);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}
.card:hover .thumb::before { opacity: 1; transform: translateY(0); }

.card-body {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  row-gap: 3px;
  align-items: baseline;
  padding: 15px 16px 16px;
}

.card-num {
  grid-row: 1 / span 2;
  align-self: start;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--pick);
  padding-top: 3px;
}

.card-name {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}

.card-blurb {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.card-tick {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 100px;
  background: var(--pick);
  color: #05261c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  z-index: 2;
}
.card.is-chosen .card-tick { display: inline-flex; }

/* ── Process steps ────────────────────────────────────────────────────── */

.steps {
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.steps-title {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(36px, 5vw, 60px) clamp(20px, 5vw, 56px) 0;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.025em;
}
.steps-row {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 3vw, 44px);
  padding: clamp(22px, 3vw, 36px) clamp(20px, 5vw, 56px) clamp(40px, 5vw, 64px);
}
.step-n {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--pick);
}
.step h3 {
  margin: 10px 0 8px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.step p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-dim);
}

/* ── Footer ───────────────────────────────────────────────────────────── */

.foot {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) clamp(20px, 5vw, 56px) clamp(36px, 4vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(24px, 4vw, 60px);
}
.foot-brand b {
  display: block;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-bottom: 5px;
}
.foot-brand span {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.foot-note p {
  margin: 0 0 16px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 52ch;
}
.foot-mail {
  display: inline-block;
  padding: 12px 24px;
  border: 1px solid var(--line-mid);
  border-radius: 100px;
  color: var(--pick);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 160ms var(--ease);
}
.foot-mail:hover { border-color: var(--pick); }
.foot-fine {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── Preview ──────────────────────────────────────────────────────────── */

.preview {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--void);
}

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(12px, 2vw, 20px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}

.bar-mid {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
}

.bar-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 190px;
  justify-content: center;
}
.bar-title strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.bar-title span {
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms var(--ease), border-color 150ms var(--ease);
}
.bar-btn:hover { color: var(--ink); border-color: var(--line-mid); }

.bar-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 150ms var(--ease), background 150ms var(--ease);
}
.bar-step:hover { color: var(--ink); background: var(--surface-2); }

.bar-choose {
  border-color: var(--line-mid);
  color: var(--ink);
  background: var(--surface-2);
}
.bar-choose:hover { border-color: var(--pick); color: var(--pick); }

.bar-choose.is-chosen {
  background: var(--pick-dim);
  border-color: var(--pick);
  color: var(--pick);
}

.widths {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.w-btn {
  padding: 7px 11px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-faint);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms var(--ease), background 150ms var(--ease);
}
.w-btn:last-child { border-right: 0; }
.w-btn:hover { color: var(--ink); }
.w-btn.is-on { background: #23272f; color: var(--ink); }

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding: 0;
  background:
    repeating-conic-gradient(#101115 0% 25%, #0c0d10 0% 50%) 50% / 22px 22px;
  overflow: hidden;
}

.stage iframe {
  width: 100%;
  max-width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  transition: max-width 260ms var(--ease);
}

.stage.w-t iframe { max-width: 834px; }
.stage.w-m iframe { max-width: 390px; }
.stage.w-t, .stage.w-m { padding: 18px 0; }
.stage.w-t iframe, .stage.w-m iframe {
  height: 100%;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}

/* ── Toast ────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 90;
  transform: translate(-50%, 14px);
  padding: 10px 17px;
  border: 1px solid var(--line-mid);
  border-radius: 100px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.toast.is-up {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Small screens ────────────────────────────────────────────────────── */

@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; }
  .devscene { min-height: 340px; max-width: 560px; }
}
@media (max-width: 720px) {
  .head-nav { display: none; }
  .hero-meta { grid-template-columns: 1fr; gap: 14px; }
  .steps-row { grid-template-columns: 1fr; }
  .foot { grid-template-columns: 1fr; }
  .bar { gap: 8px; }
  .bar-mid { order: 3; width: 100%; margin: 0; }
  .bar-right { gap: 8px; }
  .widths { display: none; }        /* width toggle is meaningless on a phone */
  .bar-btn { padding: 7px 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
