/* Muzammil Sham — handheld homepage */
:root {
  --ink: #221d3a;
  --ink-dim: #5a5470;
  --paper: #ece7dd;
  --indigo-hi: rgba(150, 130, 255, .55);
  --indigo: rgba(96, 76, 214, .86);
  --indigo-lo: rgba(54, 36, 150, .93);
  --plastic-dark: #221d3a;
  --magenta: #d21f78;
  --magenta-hi: #ff62ae;
  --magenta-lo: #7d0f45;
  --lcd: #f1ebd6;
  --lcd-ink: #1f1a35;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  background:
    radial-gradient(70% 55% at 50% 32%, #fbf8f2 0%, rgba(251, 248, 242, 0) 70%),
    linear-gradient(180deg, #e9e4da 0%, #ddd6c8 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 3px; border-radius: 4px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 10; }
.skip:focus { top: 1rem; }

/* ---------- Top line: name + contact before anyone touches the console ---------- */
.topline {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem clamp(1rem, 3vw, 2.5rem);
}
.who { font-weight: 700; text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.topline nav { display: flex; gap: .15rem; }
.topline nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .7rem;
  text-decoration: none; color: var(--ink-dim); border-radius: 999px;
}
.topline nav a:hover { color: var(--ink); }
.topline .contact-link { color: #fff; background: var(--ink); margin-left: .3rem; }
.topline .contact-link:hover { color: #fff; background: #3a3160; }

/* ---------- Surface and handheld shell ---------- */
.surface {
  display: grid; justify-items: center;
  padding: clamp(.75rem, 2.5vh, 2rem) clamp(.5rem, 3vw, 2rem) 1.25rem;
  perspective: 1800px;
}
.handheld {
  --pad: clamp(26px, 3vw, 46px);
  position: relative;
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(360px, 640px) minmax(150px, 1fr);
  align-items: center;
  gap: clamp(14px, 2vw, 34px);
  padding: calc(var(--pad) + 8px) var(--pad) calc(var(--pad) + 4px);
  border-radius: 64px 64px 150px 150px / 56px 56px 120px 120px;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--indigo-hi), rgba(150, 130, 255, 0) 60%),
    linear-gradient(180deg, var(--indigo) 0%, var(--indigo-lo) 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .38),
    inset 0 -7px 0 rgba(28, 14, 92, .5),
    inset 10px 0 18px rgba(255, 255, 255, .10),
    inset -10px 0 18px rgba(20, 10, 70, .28),
    0 2px 0 #2c1d86,
    0 40px 46px -26px rgba(30, 20, 70, .65),
    0 14px 18px -10px rgba(30, 20, 70, .38);
  transform: rotateX(7deg);
  transform-origin: 50% 100%;
}
.handheld::after { /* contact shadow on the surface */
  content: ""; position: absolute; left: 8%; right: 8%; bottom: -26px; height: 34px; z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, rgba(30, 20, 60, .35), rgba(30, 20, 60, 0));
  filter: blur(6px);
}

/* Visible internals through the translucent plastic */
.shell-internals { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.rib { position: absolute; top: 9%; bottom: 12%; width: 10px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(25, 12, 90, .22), rgba(255, 255, 255, .08), rgba(25, 12, 90, .22)); }
.r1 { left: 21%; } .r2 { right: 21%; } .r3 { left: 50%; top: auto; bottom: 4%; height: 7%; width: 30%; transform: translateX(-50%); }
.board { position: absolute; border-radius: 10px; background: rgba(22, 10, 70, .2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
.board::before { content: ""; position: absolute; inset: 22% 18%; border-radius: 4px; background: rgba(15, 6, 50, .28); }
.b1 { left: 5%; bottom: 11%; width: 13%; height: 22%; }
.b2 { right: 5%; bottom: 14%; width: 11%; height: 16%; }
.screw { position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(255, 255, 255, .45), rgba(40, 25, 120, .55) 60%); }
.screw::after { content: ""; position: absolute; left: 2px; right: 2px; top: 5px; height: 2px; background: rgba(20, 10, 60, .5); transform: rotate(35deg); }
.s1 { left: 6%; top: 14%; } .s2 { right: 6%; top: 14%; } .s3 { left: 30%; bottom: 7%; } .s4 { right: 30%; bottom: 7%; }

/* Shoulder buttons */
.shoulder {
  position: absolute; top: -9px; width: 22%; height: 26px; border: 0; z-index: 0;
  font: 700 .8rem/1 var(--sans); color: rgba(255, 255, 255, .7); cursor: pointer;
  background: linear-gradient(180deg, #5a46c9, #3a2a9e);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), 0 3px 0 #23176b;
  transition: transform 70ms, box-shadow 70ms;
}
.shoulder-l { left: 7%; border-radius: 40px 16px 0 0; text-align: left; padding-left: 22px; }
.shoulder-r { right: 7%; border-radius: 16px 40px 0 0; text-align: right; padding-right: 22px; }
.shoulder:active, .shoulder.is-pressed { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), 0 0 0 #23176b; }

/* ---------- Grips and controls ---------- */
.grip { position: relative; z-index: 1; display: grid; justify-items: center; gap: 14px; }
.print {
  margin: 0; font: 600 .78rem/1.2 var(--sans); letter-spacing: .06em; color: rgba(255, 255, 255, .86);
  text-shadow: 0 1px 0 rgba(20, 10, 70, .5); text-transform: uppercase; white-space: nowrap;
}
.handheld button:focus-visible, .handheld .pill:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* D-pad */
.dpad {
  --cell: clamp(38px, 3.6vw, 48px);
  display: grid; grid-template-columns: repeat(3, var(--cell)); grid-template-rows: repeat(3, var(--cell));
  filter: drop-shadow(0 6px 4px rgba(20, 10, 60, .35));
}
.dp, .dp-hub { background: linear-gradient(180deg, #34304c, #1d1a30); border: 0; }
.dp {
  position: relative; padding: 0; cursor: pointer; color: transparent;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .14), 0 4px 0 #0e0c1a;
  transition: transform 60ms, box-shadow 60ms;
}
.dp.up    { grid-area: 1 / 2; border-radius: 9px 9px 0 0; }
.dp.left  { grid-area: 2 / 1; border-radius: 9px 0 0 9px; }
.dp-hub   { grid-area: 2 / 2; box-shadow: 0 4px 0 #0e0c1a; position: relative; }
.dp-hub::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #15132a, #2c2844); }
.dp.right { grid-area: 2 / 3; border-radius: 0 9px 9px 0; }
.dp.down  { grid-area: 3 / 2; border-radius: 0 0 9px 9px; }
.dp span { position: absolute; left: 50%; top: 50%; width: 0; height: 0; border: 7px solid transparent; transform: translate(-50%, -50%); }
.dp.up span    { border-bottom-color: #6f6a8c; margin-top: -4px; }
.dp.down span  { border-top-color: #6f6a8c; margin-top: 4px; }
.dp.left span  { border-right-color: #6f6a8c; margin-left: -4px; }
.dp.right span { border-left-color: #6f6a8c; margin-left: 4px; }
.dp:active, .dp.is-pressed { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08), 0 1px 0 #0e0c1a; }

/* A / B */
.ab { display: grid; grid-template-columns: auto auto; gap: 4px 14px; align-items: end; }
.btn-wrap { display: grid; justify-items: center; gap: 8px; }
.a-wrap { transform: translateY(-34px); }
.round {
  width: clamp(56px, 5vw, 68px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  font: 800 1.05rem/1 var(--sans); color: rgba(255, 255, 255, .92);
  background: radial-gradient(circle at 36% 30%, var(--magenta-hi), var(--magenta) 58%, #a3155b 100%);
  box-shadow: inset 0 -3px 0 rgba(80, 0, 40, .35), 0 6px 0 var(--magenta-lo), 0 10px 12px rgba(30, 10, 40, .35);
  transition: transform 60ms, box-shadow 60ms;
}
.round:active, .round.is-pressed {
  transform: translateY(5px);
  box-shadow: inset 0 -2px 0 rgba(80, 0, 40, .35), 0 1px 0 var(--magenta-lo), 0 3px 5px rgba(30, 10, 40, .3);
}

/* Pills and grille */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; min-width: 104px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 .78rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
  color: rgba(255, 255, 255, .92); background: linear-gradient(180deg, #2f2a4b, #1c1830);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 3px 0 #0e0c1a;
  transition: transform 60ms, box-shadow 60ms;
}
.pill:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 #0e0c1a; }
.pill[aria-pressed="true"] { color: #1c1830; background: linear-gradient(180deg, #ffe08a, #f2b63b); }
.grille {
  width: 74px; height: 38px; opacity: .8;
  background: radial-gradient(circle, rgba(18, 8, 60, .55) 2.2px, transparent 2.6px) 0 0 / 10px 10px;
}
button:disabled { cursor: default; }

/* ---------- Screen face ---------- */
.face { position: relative; z-index: 1; }
.bezel {
  position: relative;
  padding: clamp(14px, 1.8vw, 24px) clamp(18px, 2.6vw, 38px) clamp(16px, 2vw, 26px);
  border-radius: 18px 18px 46px 18px;
  background: linear-gradient(180deg, #2a2644, #1a1730);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .12), inset 0 -2px 0 rgba(0, 0, 0, .4), 0 2px 0 rgba(255, 255, 255, .25);
}
.power {
  position: absolute; left: clamp(6px, 1vw, 13px); top: 44%; width: 7px; height: 7px; border-radius: 50%;
  background: #7cff9a; box-shadow: 0 0 6px #49e477;
}
.shell-name {
  margin: 14px 0 0; text-align: center;
  font: italic 800 clamp(.8rem, 1.1vw, .98rem)/1 var(--sans); letter-spacing: .28em;
  color: rgba(255, 255, 255, .9); text-shadow: 0 1px 0 rgba(20, 10, 70, .6), 0 -1px 0 rgba(255, 255, 255, .15);
}
.shell-name span { font-weight: 500; letter-spacing: .12em; opacity: .75; text-transform: uppercase; }

/* ---------- LCD ---------- */
.lcd {
  container-type: inline-size;
  position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 4px;
  color: var(--lcd-ink); font-family: var(--mono);
  background:
    repeating-linear-gradient(0deg, rgba(40, 30, 60, .035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(40, 30, 60, .03) 0 1px, transparent 1px 3px),
    var(--lcd);
  box-shadow: inset 0 0 0 2px #0c0a18, inset 0 0 18px rgba(30, 20, 50, .25);
}
.view {
  position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto auto;
  padding: 3cqw 4cqw 3.2cqw;
}
.view[hidden] { display: none; }
.lcd p { margin: 0; }
.lcd-bar {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: max(10px, 2.5cqw); font-weight: 700; letter-spacing: .14em;
  padding-bottom: 1.6cqw; border-bottom: 2px solid rgba(31, 26, 53, .85);
}

/* Cartridges */
.carts {
  list-style: none; margin: 0; padding: 0 1cqw;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3.5cqw; align-items: end; align-self: center;
}
.cart {
  display: grid; justify-items: center; gap: 1.6cqw; text-decoration: none; color: var(--lcd-ink);
  border-radius: 6px; padding: 1cqw;
  transition: transform 140ms ease;
}
.cart-arrow { color: var(--magenta); font-size: max(10px, 3cqw); line-height: 1; visibility: hidden; }
.cart-body {
  position: relative; width: 100%;
  padding: 8% 7% 18%;
  border-radius: 7% 7% 4% 4% / 9% 9% 5% 5%;
  background: linear-gradient(180deg, #c9c4d8, #a8a2bd);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -3px 0 rgba(60, 50, 90, .35), 0 3px 0 #6d6788;
}
.cart-body::before { /* top grip notch */
  content: ""; position: absolute; top: 3%; right: 9%; width: 22%; height: 4%; border-radius: 2px;
  background: rgba(60, 50, 90, .35);
}
.cart-body::after { /* bottom ridges */
  content: ""; position: absolute; left: 22%; right: 22%; bottom: 6%; height: 8%;
  background: repeating-linear-gradient(90deg, rgba(60, 50, 90, .4) 0 2px, transparent 2px 6px);
}
.cart-body img {
  width: 100%; height: auto; aspect-ratio: 3 / 2; image-rendering: pixelated;
  border: 2px solid #1f1a35; border-radius: 2px; background: #1f1a35;
}
.cart-name {
  font-size: max(10px, 2.6cqw); font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  text-align: center; line-height: 1.2; color: rgba(31, 26, 53, .7);
}
.cart[aria-current="true"] { transform: translateY(-1.4cqw) scale(1.06); }
.cart[aria-current="true"] .cart-arrow { visibility: visible; animation: bob 900ms steps(2, end) infinite; }
.cart[aria-current="true"] .cart-body { outline: 3px solid var(--magenta); outline-offset: 2px; }
.cart[aria-current="true"] .cart-name { color: var(--lcd-ink); }
.cart:focus-visible { outline: 3px dashed var(--magenta); outline-offset: 2px; }
@keyframes bob { 50% { transform: translateY(-.8cqw); } }

.lcd-info {
  text-align: center; font-family: var(--sans); font-size: max(13px, 3.6cqw); line-height: 1.25;
  padding: 1cqw 0 1.4cqw;
}
.lcd-info strong { font-weight: 800; }
.lcd-hint, .open-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  font-size: max(10px, 2.4cqw); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding-top: 1.4cqw; border-top: 2px solid rgba(31, 26, 53, .85);
}
.lcd-count { color: var(--magenta); }

/* Open project view */
.view-open { grid-template-rows: auto 1fr auto; }
.open-media { margin: 2cqw 0 1.6cqw; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 1.4cqw; justify-items: center; }
.open-media img { height: 100%; width: auto; max-width: 100%; object-fit: contain; min-height: 0;
  border: 2px solid #1f1a35; border-radius: 3px; }
.open-media.cover img { image-rendering: pixelated; }
.open-media figcaption { font-family: var(--sans); font-size: max(12px, 2.7cqw); line-height: 1.3; text-align: center; }
.lcd-btn {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 3cqw; border-radius: 4px;
  background: var(--lcd-ink); color: var(--lcd); text-decoration: none; letter-spacing: .08em;
}
.lcd-btn:hover { background: var(--magenta); }
.lcd-muted { color: rgba(31, 26, 53, .65); }

/* Real artwork on the Selat Saga cartridge: smooth, not pixelated */
.cart-body img.photo { image-rendering: auto; object-fit: cover; }

/* Open project and gallery */
.open-media:has(.open-label) { grid-template-rows: auto minmax(0, 1fr); }
.open-label {
  font-family: var(--sans); font-weight: 800; font-size: max(12px, 2.8cqw); letter-spacing: .02em;
  justify-self: start; width: 100%;
}
.view-gallery { grid-template-rows: auto 1fr auto; }
.view-gallery figcaption { font-weight: 800; font-size: max(14px, 3.4cqw); }
.open-actions { flex-wrap: wrap; row-gap: 1cqw; }
.lcd-link { color: var(--lcd-ink); min-height: 36px; display: inline-flex; align-items: center; text-decoration: underline; }
.lcd-step {
  min-width: 44px; min-height: 40px; border: 0; border-radius: 4px; cursor: pointer;
  background: var(--lcd-ink); color: var(--lcd); font: 700 14px/1 var(--mono);
}
.lcd-step:hover { background: var(--magenta); }
.lcd-step:active { transform: translateY(1px); }
.lcd-step:focus-visible, .lcd-btn:focus-visible, .lcd-link:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; }

.cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.1rem; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 650; text-decoration: none;
}
.cta:hover { background: #3a3160; }

.keys-hint { margin: 2.2rem 0 0; font-size: .85rem; color: var(--ink-dim); text-align: center; }
html:not(.js) .keys-hint { display: none; }

/* ---------- Below the console ---------- */
.below { max-width: 860px; margin: 0 auto; padding: 2rem clamp(1rem, 3vw, 2.5rem); border-top: 1px solid rgba(34, 29, 58, .14); }
.below h2 { font-size: 1.4rem; margin: 0 0 1rem; }
.below p { max-width: 62ch; }
.worklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.worklist li { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; padding: .6rem 0; border-bottom: 1px dashed rgba(34, 29, 58, .18); }
.worklist a { min-height: 44px; display: inline-flex; align-items: center; }
.worklist span { color: var(--ink-dim); }
.flag { padding: .55rem .9rem; border-left: 3px solid #b98a2e; background: rgba(255, 255, 255, .55); font-size: .95rem; }
.flag.blocker { border-left-color: #d1352b; }
.foot { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem clamp(1rem, 3vw, 2.5rem); color: var(--ink-dim); font-size: .9rem; }

/* ---------- Portrait phones: screen first, controls below ---------- */
@media (max-width: 760px) {
  .surface { perspective: none; padding-top: .25rem; }
  .handheld {
    --pad: 14px;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "face face" "left right";
    gap: 18px 8px;
    padding: 22px 12px 26px;
    border-radius: 30px 30px 64px 64px / 30px 30px 54px 54px;
    transform: none;
  }
  .face { grid-area: face; }
  .grip-left { grid-area: left; }
  .grip-right { grid-area: right; }
  .bezel { padding: 12px 12px 14px 20px; border-radius: 14px 14px 30px 14px; }
  .power { left: 7px; }
  .lcd { aspect-ratio: 5 / 4; }
  .carts { gap: 3cqw; padding: 0; }
  .cart-name { font-size: 11px; }
  .lcd-bar, .lcd-hint, .open-actions { font-size: 10px; letter-spacing: .08em; }
  .lcd-info { font-size: 15px; }
  .view-open .hint-b { display: none; } /* the B button is right below; keep the action row on one line */
  .lcd-btn { padding: 0 7px; }
  .view-open .open-actions { gap: .5rem; letter-spacing: .02em; }
  .shoulder { height: 20px; top: -7px; width: 30%; font-size: .7rem; }
  .shell-name { margin-top: 10px; font-size: .78rem; }
  .dpad { --cell: 46px; }
  .round { width: 60px; }
  .a-wrap { transform: translateY(-26px); }
  .r1, .r2, .b1, .b2 { display: none; }
  .grille { display: none; }
  .keys-hint { display: none; }
}
@media (max-width: 380px) {
  .dpad { --cell: 42px; }
  .round { width: 54px; }
  .ab { gap: 4px 8px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cart, .round, .dp, .pill, .shoulder { transition: none; }
  .cart[aria-current="true"] .cart-arrow { animation: none; }
}
