/* ==========================================================================
   Ankit Karna · portfolio
   Palette: cool "view debugger" greys with cobalt, teal and amber layer colors
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #eef1f5;
  --surface: #ffffff;
  --ink: #0f1a2e;
  --muted: #4f5a6e;
  --line: #d5dbe5;
  --accent: #3047e0;
  --accent-ink: #2236b8;
  --accent-soft: #e3e7ff;
  --teal: #0f9fb3;
  --amber: #e8961f;
  --window: #dfe5ef;
  --band: #0f1a2e;
  --band-ink: #e9eef7;
  --band-muted: #a7b2c6;
  --shadow: 0 30px 60px -30px rgb(15 26 46 / .35);

  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: .84rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
  --step-3: clamp(2rem, 1.4rem + 2.6vw, 3.4rem);
  --step-4: clamp(3.6rem, 2rem + 7vw, 7.5rem);

  --radius-lg: 1.5rem;
  --radius-md: .75rem;
  --radius-sm: .4rem;
  --header-h: 4.5rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1424;
  --surface: #141d31;
  --ink: #e8edf6;
  --muted: #9aa6bb;
  --line: #26314a;
  --accent: #8492ff;
  --accent-ink: #a9b3ff;
  --accent-soft: #1d2750;
  --teal: #2cc3d6;
  --amber: #f3ab45;
  --window: #1b2640;
  --band: #070c17;
  --shadow: 0 30px 60px -30px rgb(0 0 0 / .7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1424;
    --surface: #141d31;
    --ink: #e8edf6;
    --muted: #9aa6bb;
    --line: #26314a;
    --accent: #8492ff;
    --accent-ink: #a9b3ff;
    --accent-soft: #1d2750;
    --teal: #2cc3d6;
    --amber: #f3ab45;
    --window: #1b2640;
    --band: #070c17;
    --shadow: 0 30px 60px -30px rgb(0 0 0 / .7);
  }
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s, color .3s;
}

h1, h2, h3, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

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

.shell {
  width: min(100% - clamp(2rem, 7vw, 6rem), 74rem);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 50;
  top: .75rem;
  left: .75rem;
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

[data-todo] { display: none !important; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  transition: border-color .25s;
}
.site-header[data-scrolled] { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  margin-right: auto;
  font-weight: 750;
  letter-spacing: -.02em;
  text-decoration: none;
}

/* Monogram: three offset planes, a nod to the layer stack in the hero */
.monogram {
  position: relative;
  width: 1.9rem;
  height: 1.9rem;
}
.monogram i {
  position: absolute;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: .3rem;
}
.monogram i:nth-child(1) { left: 0; bottom: 0; background: var(--accent); }
.monogram i:nth-child(2) { left: .35rem; bottom: .35rem; background: color-mix(in srgb, var(--teal) 85%, transparent); mix-blend-mode: multiply; }
.monogram i:nth-child(3) { left: .7rem; bottom: .7rem; border: 2px solid var(--amber); }
:root[data-theme="dark"] .monogram i:nth-child(2) { mix-blend-mode: screen; }

.site-nav {
  display: flex;
  gap: .25rem;
}
.site-nav a {
  padding: .45rem .8rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.header-actions { display: flex; gap: .4rem; }

.icon-button {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s;
}
.icon-button:hover { border-color: var(--accent); }
.icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.menu-button { display: none; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding-block: clamp(2.5rem, 6vw, 5.5rem) clamp(3rem, 7vw, 6.5rem);
}

.kicker {
  color: var(--muted);
  font-size: var(--step-0);
  font-weight: 500;
}

h1 {
  margin-top: .6rem;
  font-size: var(--step-4);
  font-weight: 850;
  line-height: .9;
  letter-spacing: -.055em;
}

.hero-lead {
  max-width: 22ch;
  margin-top: 1.8rem;
  font-size: var(--step-2);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.hero-description {
  max-width: 46ch;
  margin-top: .9rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 3rem;
  padding: .6rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .95rem;
  font-weight: 650;
  text-decoration: none;
  transition: background-color .2s, border-color .2s, color .2s;
}
:root[data-theme="dark"] .button:not(.button-quiet) { color: #0d1424; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .button:not(.button-quiet) { color: #0d1424; }
}
.button:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.button-quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}
.button-quiet:hover { background: var(--surface); border-color: var(--accent); }

/* ---------- Layer stage (the signature piece) ---------- */

.stage {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
}

.stage-scene {
  display: grid;
  width: 100%;
  min-height: 34rem;
  place-items: center;
  perspective: 1800px;
}

.phone {
  --w: 15.5rem;
  --h: 31rem;
  --gap: 0px;
  position: relative;
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
  transform: rotateX(0) rotateZ(0);
  transition: transform 1.1s cubic-bezier(.2, .8, .2, 1);
}

.stage[data-exploded] .phone {
  --gap: 4.2rem;
  transform: translateY(2.5rem) rotateX(56deg) rotateZ(-34deg);
}

.layer {
  position: absolute;
  inset: 0;
  border-radius: 2.2rem;
  transform: translateZ(calc(var(--i) * var(--gap)));
  transition: transform 1.1s cubic-bezier(.2, .8, .2, 1), background-color .6s, box-shadow .6s, outline-color .6s;
  outline: 1.5px solid transparent;
}

.layer-window {
  background: var(--window);
  box-shadow: var(--shadow), 0 0 0 .55rem var(--ink);
}
.stage[data-exploded] .layer-window { box-shadow: var(--shadow), 0 0 0 .55rem var(--ink); }

.layer-views { padding: 1.4rem 1.2rem; }
.stage[data-exploded] .layer-views {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  outline-color: color-mix(in srgb, var(--accent) 70%, transparent);
}
.stage[data-exploded] .layer-surface {
  background: color-mix(in srgb, var(--teal) 6%, transparent);
  outline-color: color-mix(in srgb, var(--teal) 70%, transparent);
}
.stage[data-exploded] .layer-mask {
  background: color-mix(in srgb, var(--amber) 6%, transparent);
  outline-color: color-mix(in srgb, var(--amber) 75%, transparent);
}

/* Mock app UI on the view layer */
.ui-bar { width: 32%; height: .45rem; margin: 0 auto 1.4rem; border-radius: 1rem; background: var(--ink); opacity: .85; }
.ui-title { width: 60%; height: 1rem; border-radius: .3rem; background: var(--ink); }
.layer-views::after {
  /* outline of where the rendered surface sits */
  content: "";
  position: absolute;
  top: 4.8rem;
  left: 1.2rem;
  right: 1.2rem;
  height: 8.5rem;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  border-radius: .9rem;
}
.ui-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-top: .85rem;
}
.ui-row:first-of-type { margin-top: 10.2rem; }
.ui-row b { width: 2rem; height: 2rem; flex: none; border-radius: .6rem; background: var(--accent); opacity: .9; }
.ui-row:nth-of-type(2) b { background: var(--teal); }
.ui-row:nth-of-type(3) b { background: var(--amber); }
.ui-row span { height: .6rem; flex: 1; border-radius: .3rem; background: color-mix(in srgb, var(--muted) 45%, transparent); }
.ui-row:nth-of-type(2) span { flex: .7; }
.ui-field {
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  bottom: 5.1rem;
  height: 2.5rem;
  border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent);
  border-radius: .7rem;
  background: var(--surface);
}
.ui-cta {
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  bottom: 1.6rem;
  height: 2.6rem;
  border-radius: .8rem;
  background: var(--ink);
}

.surface {
  position: absolute;
  top: 4.8rem;
  left: 1.2rem;
  right: 1.2rem;
  height: 8.5rem;
  overflow: hidden;
  border-radius: .9rem;
  background:
    radial-gradient(circle at 70% 35%, rgb(255 255 255 / .55) 0 .5rem, transparent .55rem),
    linear-gradient(160deg, transparent 55%, rgb(255 255 255 / .18) 55% 62%, transparent 62%),
    linear-gradient(20deg, transparent 40%, rgb(255 255 255 / .14) 40% 46%, transparent 46%),
    linear-gradient(135deg, var(--teal), color-mix(in srgb, var(--teal) 40%, var(--accent)));
}

.mask {
  position: absolute;
  /* lines up with .ui-field */
  left: 1.2rem;
  right: 1.2rem;
  bottom: 5.1rem;
  height: 2.5rem;
  border-radius: .7rem;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 .45rem, color-mix(in srgb, var(--amber) 55%, transparent) .45rem .9rem);
}

.layer-tag {
  position: absolute;
  top: .4rem;
  left: calc(100% + 1rem);
  padding: .2rem .55rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 0 0 1px var(--line);
  opacity: 0;
  transition: opacity .4s;
}
.layer-views .layer-tag { color: var(--accent-ink); }
.layer-surface .layer-tag { color: var(--teal); }
.layer-mask .layer-tag { color: color-mix(in srgb, var(--amber) 70%, var(--ink)); }
.stage[data-exploded] .layer-tag { opacity: 1; transition-delay: .7s; }

.stage figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5rem 1rem;
  text-align: center;
}

.stage-toggle {
  padding: .5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .2s;
}
.stage-toggle:hover { border-color: var(--accent); }
.stage-note { color: var(--muted); font-size: .9rem; }

/* ---------- Work ---------- */

.work {
  padding-block: clamp(3.5rem, 8vw, 7rem);
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 1rem 3rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.section-head p {
  max-width: 40ch;
  justify-self: end;
  color: var(--muted);
  font-size: var(--step-1);
}

h2 {
  font-size: var(--step-3);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.045em;
}

.platforms { list-style: none; border-top: 1px solid var(--line); }

.platform {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr) 16rem;
  align-items: baseline;
  gap: 1rem 2.5rem;
  padding-block: clamp(1.5rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--line);
}
.platform h3 {
  font-size: var(--step-2);
  font-weight: 750;
  letter-spacing: -.03em;
}
.platform p { max-width: 52ch; color: var(--muted); font-size: 1.05rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
}
.tags li {
  padding: .2rem .65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: .82rem;
  font-weight: 600;
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 6vw, 6rem);
  padding-block: clamp(3.5rem, 8vw, 7rem);
}
.about-intro p {
  max-width: 38ch;
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: var(--step-1);
}
.about-lead { font-size: var(--step-1); font-weight: 500; }

.interests { list-style: none; margin-top: 1.2rem; }
.interests li {
  position: relative;
  padding: 1.1rem 0 1.1rem 2.2rem;
  border-top: 1px solid var(--line);
  font-size: var(--step-2);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.02em;
}
.interests li:last-child { border-bottom: 1px solid var(--line); }
.interests li::before {
  content: "";
  position: absolute;
  top: 1.45rem;
  left: 0;
  width: .9rem;
  height: .9rem;
  border-radius: .25rem;
  background: var(--accent);
}
.interests li:nth-child(2)::before { background: var(--teal); }
.interests li:nth-child(3)::before { background: transparent; border: 2px solid var(--amber); }

/* ---------- Contact ---------- */

.contact {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  background: var(--band);
  color: var(--band-ink);
}
/* Stay hidden until at least one contact link is filled in */
.contact:not(:has(.contact-links > li:not([data-todo]))) { display: none; }

.contact-inner > p {
  max-width: 46ch;
  margin-top: 1rem;
  color: var(--band-muted);
  font-size: var(--step-1);
}

.contact-links {
  display: grid;
  margin-top: 2.5rem;
  list-style: none;
  border-top: 1px solid rgb(255 255 255 / .14);
}
.contact-links li {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgb(255 255 255 / .14);
}
.contact-link {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  flex: 1;
  align-items: baseline;
  gap: 1rem;
  padding-block: 1.2rem;
  text-decoration: none;
}
.contact-kind { color: var(--band-muted); font-size: .95rem; }
.contact-value {
  overflow-wrap: anywhere;
  font-size: var(--step-2);
  font-weight: 650;
  letter-spacing: -.02em;
}
.contact-link:hover .contact-value {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .2em;
}
.copy-button {
  padding: .4rem .9rem;
  border: 1px solid rgb(255 255 255 / .25);
  border-radius: 999px;
  background: transparent;
  color: var(--band-ink);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.copy-button:hover { border-color: var(--band-ink); }

/* ---------- Footer ---------- */

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5rem;
  color: var(--muted);
  font-size: .92rem;
}
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  z-index: 40;
  bottom: 1.5rem;
  left: 50%;
  padding: .6rem 1.1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: .9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, .75rem);
  transition: opacity .25s, transform .25s;
}
.toast[data-visible] { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 404 ---------- */

.error-page {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 1rem;
  min-height: calc(100vh - var(--header-h) - 5rem);
  padding-block: 4rem;
}
.error-page p { max-width: 40ch; color: var(--muted); font-size: var(--step-1); }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .platform { grid-template-columns: 10rem minmax(0, 1fr); }
  .platform .tags { grid-column: 2; }
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .stage-scene { min-height: 30rem; }
  .phone { --w: 13.5rem; --h: 27rem; }
  .ui-row:first-of-type { margin-top: 9.2rem; }
  .ui-row:nth-of-type(3) { display: none; }
  .layer-views::after, .surface { height: 7.5rem; }
  .stage[data-exploded] .phone { --gap: 3.4rem; }

  .section-head, .about { grid-template-columns: 1fr; }
  .section-head p { justify-self: start; }
}

@media (max-width: 720px) {
  .menu-button { display: grid; }
  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: .75rem clamp(1rem, 3.5vw, 3rem) 1.25rem;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    display: none;
  }
  .site-nav[data-open] { display: flex; }
  .site-nav a { padding: .8rem 1rem; font-size: 1.05rem; }

  .platform { grid-template-columns: 1fr; gap: .6rem; }
  .platform .tags { grid-column: auto; margin-top: .4rem; }

  .contact-link { grid-template-columns: 1fr; gap: .15rem; }
  .layer-tag { display: none; }
  .stage-scene { min-height: 24rem; overflow: hidden; }
  .stage[data-exploded] .phone { transform: translateY(1.5rem) rotateX(56deg) rotateZ(-34deg) scale(.8); }
}

@media (max-width: 420px) {
  .phone { --w: 12rem; --h: 24rem; }
  .layer-views { padding: 1.2rem 1rem; }
  .layer-views::after, .surface, .mask { left: 1rem; right: 1rem; }
  .layer-views::after, .surface { top: 4.4rem; height: 6.2rem; }
  .ui-row:first-of-type { margin-top: 7.6rem; }
  .ui-row b { width: 1.6rem; height: 1.6rem; }
  .ui-field, .ui-cta { left: 1rem; right: 1rem; }
  .ui-field { height: 2.1rem; bottom: 4.65rem; }
  .mask { height: 2.1rem; bottom: 4.65rem; }
  .ui-cta { height: 2.2rem; }
  .stage-scene { min-height: 21rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    animation: none !important;
  }
}

@media print {
  .site-header, .stage figcaption, .copy-button, .toast { display: none; }
  body { background: #fff; color: #000; }
  .work, .contact { background: none; color: #000; border: 0; }
}
