/* ENVX — Apple-inspired ceramic glass.
   Light: white porcelain. Dark: black ceramic. Both share the same layered glaze. */

:root {
  --accent-1: #fb5c74;
  --accent-2: #fa233b;
  --accent: linear-gradient(180deg, var(--accent-1), var(--accent-2));

  --bg: #f3f1ee;
  --ink: #1d1d1f;
  --ink-2: rgba(29, 29, 31, .6);
  --ink-3: rgba(29, 29, 31, .38);

  /* ceramic glaze */
  --glaze-top: rgba(255, 255, 255, .82);
  --glaze-bottom: rgba(255, 255, 255, .5);
  --glaze-edge: rgba(255, 255, 255, .95);
  --glaze-lip: rgba(255, 255, 255, 1);
  --glaze-foot: rgba(70, 50, 90, .1);
  --shadow-near: rgba(40, 25, 50, .07);
  --shadow-far: rgba(40, 25, 50, .16);
  --grain-blend: multiply;
  --grain-opacity: .05;

  --pool-1: #ffc2cf;
  --pool-2: #e7d6ff;
  --pool-3: #ffe1c2;
  --pool-opacity: .9;

  --radius-xl: 34px;
  --radius-lg: 26px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0e;
    --ink: #f5f5f7;
    --ink-2: rgba(245, 245, 247, .62);
    --ink-3: rgba(245, 245, 247, .36);
    --glaze-top: rgba(58, 58, 64, .66);
    --glaze-bottom: rgba(22, 22, 26, .58);
    --glaze-edge: rgba(255, 255, 255, .1);
    --glaze-lip: rgba(255, 255, 255, .16);
    --glaze-foot: rgba(0, 0, 0, .35);
    --shadow-near: rgba(0, 0, 0, .35);
    --shadow-far: rgba(0, 0, 0, .55);
    --grain-blend: overlay;
    --grain-opacity: .08;
    --pool-1: #5a1424;
    --pool-2: #2a1a52;
    --pool-3: #3d2410;
    --pool-opacity: .75;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0e;
  --ink: #f5f5f7;
  --ink-2: rgba(245, 245, 247, .62);
  --ink-3: rgba(245, 245, 247, .36);
  --glaze-top: rgba(58, 58, 64, .66);
  --glaze-bottom: rgba(22, 22, 26, .58);
  --glaze-edge: rgba(255, 255, 255, .1);
  --glaze-lip: rgba(255, 255, 255, .16);
  --glaze-foot: rgba(0, 0, 0, .35);
  --shadow-near: rgba(0, 0, 0, .35);
  --shadow-far: rgba(0, 0, 0, .55);
  --grain-blend: overlay;
  --grain-opacity: .08;
  --pool-1: #5a1424;
  --pool-2: #2a1a52;
  --pool-3: #3d2410;
  --pool-opacity: .75;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .4s ease, color .4s ease;
}
/* fine ceramic grain over everything */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent-2) 70%, transparent); outline-offset: 3px; border-radius: 12px; }

/* ---------- ambient light pools ---------- */
.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.ambient i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: var(--pool-opacity); animation: drift 30s ease-in-out infinite alternate; }
.ambient i:nth-child(1) { width: 55vmax; height: 55vmax; left: -15vmax; top: -20vmax; background: var(--pool-1); }
.ambient i:nth-child(2) { width: 45vmax; height: 45vmax; right: -15vmax; top: 15vh; background: var(--pool-2); animation-delay: -10s; }
.ambient i:nth-child(3) { width: 50vmax; height: 50vmax; left: 25vw; bottom: -30vmax; background: var(--pool-3); animation-delay: -20s; }
@keyframes drift { to { transform: translate(5vw, 6vh) scale(1.08); } }

/* ---------- the ceramic surface ---------- */
.ceramic {
  background: linear-gradient(180deg, var(--glaze-top), var(--glaze-bottom));
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid var(--glaze-edge);
  box-shadow:
    inset 0 1px 0 var(--glaze-lip),
    inset 0 -24px 40px -28px var(--glaze-foot),
    0 1px 2px var(--shadow-near),
    0 14px 34px -10px var(--shadow-far),
    0 44px 90px -40px var(--shadow-far);
}

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; padding: max(14px, env(safe-area-inset-top)) 20px 0; }
.bar {
  max-width: 1120px; margin: 0 auto; height: 60px; border-radius: 999px;
  display: flex; align-items: center; gap: 18px; padding: 0 10px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; font-size: 17px; }
.brand img { border-radius: 8px; box-shadow: 0 4px 12px -2px rgba(250, 35, 59, .45); }
.bar-links { display: flex; gap: 4px; margin-left: 8px; }
.bar-links a { padding: 8px 14px; border-radius: 999px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); transition: background .2s, color .2s; }
.bar-links a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); transition: background .2s, color .2s; }
.round:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.round svg { width: 20px; height: 20px; }

.pill {
  height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 650; font-size: 14.5px;
  background: linear-gradient(180deg, var(--glaze-top), var(--glaze-bottom));
  border: 1px solid var(--glaze-edge);
  box-shadow: inset 0 1px 0 var(--glaze-lip), 0 2px 6px -2px var(--shadow-far);
  transition: transform .15s ease, filter .2s;
}
.pill:hover { filter: brightness(1.04); }
.pill:active { transform: scale(.97); }
.pill.primary {
  color: #fff; border-color: rgba(255, 255, 255, .25);
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -10px 18px -10px rgba(120, 0, 20, .4), 0 10px 24px -8px rgba(250, 35, 59, .55);
}
.pill[aria-disabled="true"] { opacity: .55; cursor: default; }
.pill.wide { width: 100%; height: 46px; }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 0 20px 40px; }
.hero { padding: clamp(56px, 10vw, 110px) 4px clamp(36px, 6vw, 64px); }
.hero h1 {
  margin: 0; font-size: clamp(64px, 13vw, 148px); line-height: .9; font-weight: 800; letter-spacing: -.045em;
  background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--ink) 55%, transparent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 18px 0 0; font-size: clamp(19px, 2.4vw, 26px); color: var(--ink-2); font-weight: 500; letter-spacing: -.01em; max-width: 30ch; }
.section-title { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin: 0 4px 16px; }
section + section { margin-top: 56px; }

/* ---------- featured games ---------- */
.featured { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.game {
  position: relative; border-radius: var(--radius-xl); overflow: hidden; padding: 12px; display: flex; flex-direction: column;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
}
.game:hover { transform: translateY(-4px); }
.game-art {
  position: relative; aspect-ratio: 16 / 10; border-radius: calc(var(--radius-xl) - 10px); overflow: hidden;
  background: linear-gradient(155deg, var(--c1), var(--c2) 55%, var(--c3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -30px 60px -30px rgba(0, 0, 0, .35);
}
.game-art::before { /* glaze sheen */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 48%),
              radial-gradient(120% 80% at 50% 120%, rgba(0, 0, 0, .25), transparent 60%);
}
.game-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-body { padding: 18px 10px 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2);
}
.chip.roblox { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); }
.game h3 { margin: 6px 0 0; font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
.game p { margin: 0; color: var(--ink-2); font-size: 15px; }
.game-actions { margin-top: auto; padding-top: 14px; display: flex; gap: 10px; }

/* ---------- app grid (home screen) ---------- */
.dock { border-radius: var(--radius-xl); padding: clamp(22px, 4vw, 40px); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 16px; }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.app { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.icon {
  position: relative; width: 84px; aspect-ratio: 1; border-radius: 23%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, .55),
    inset 0 -3px 6px rgba(0, 0, 0, .14),
    0 2px 4px rgba(0, 0, 0, .1),
    0 14px 26px -10px color-mix(in srgb, var(--c2) 70%, transparent);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
}
.icon::before { /* top glaze */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .42) 0%, rgba(255, 255, 255, .08) 48%, rgba(255, 255, 255, 0) 50%);
}
.icon::after { /* soft specular spot */
  content: ""; position: absolute; left: 18%; top: 7%; width: 44%; height: 20%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .5), transparent); filter: blur(2px);
}
.icon svg { position: relative; z-index: 1; width: 46%; height: 46%; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .22)); }
.app:hover .icon { transform: translateY(-4px) scale(1.04); }
.app:active .icon { transform: scale(.94); transition-duration: .1s; }
.app-name { font-size: 14px; font-weight: 600; }
.app-status { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--ink-3); margin-top: -6px; }
.app-status svg { width: 11px; height: 11px; }
.app-status.live { color: #1fa463; }

/* ---------- sheet ---------- */
.sheet {
  width: min(420px, calc(100vw - 32px)); border-radius: var(--radius-xl); padding: 28px 24px 22px; color: var(--ink);
  margin: auto;
}
.sheet::backdrop { background: rgba(10, 8, 14, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet[open] { animation: rise .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.sheet .icon { width: 72px; margin: 0 auto 14px; }
.sheet h2 { margin: 0 0 6px; text-align: center; font-size: 22px; letter-spacing: -.02em; }
.sheet p { margin: 0 0 8px; text-align: center; color: var(--ink-2); }
.sheet .when { text-align: center; font-size: 13px; color: var(--ink-3); margin-bottom: 20px; }
.sheet form { margin: 0; }

.foot { position: relative; z-index: 1; text-align: center; color: var(--ink-3); font-size: 13px; padding: 30px 20px max(30px, env(safe-area-inset-bottom)); }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .top { padding: max(10px, env(safe-area-inset-top)) 12px 0; }
  .bar { height: 56px; gap: 8px; }
  .bar-links { display: none; }
  main { padding: 0 16px 32px; }
  .featured { grid-template-columns: 1fr; gap: 18px; }
  .game h3 { font-size: 21px; }
  .dock { padding: 22px 14px; border-radius: 28px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 8px; }
  .icon { width: min(68px, 17vw); }
  .app-name { font-size: 12.5px; }
  .app-status { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- /games and /tools ---------- */
.hero.small { padding-bottom: 28px; }
.hero.small h1 { font-size: clamp(44px, 8vw, 80px); }
.bar-links a[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.projects { display: flex; flex-direction: column; gap: 22px; position: relative; z-index: 1; }
.project { border-radius: var(--radius-xl); padding: clamp(20px, 4vw, 34px); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; scroll-margin-top: 100px; }
.project h2 { margin: 4px 0 0; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.03em; }
.project .tagline { margin: 0; font-size: 18px; color: var(--ink-2); }
.project .about { margin: 0; color: var(--ink-2); white-space: pre-wrap; }
.project h3 { margin: 16px 0 2px; font-size: 16px; color: var(--ink-2); }
.patch { width: 100%; border-radius: 16px; background: color-mix(in srgb, var(--ink) 4%, transparent); padding: 12px 16px; }
.patch summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.patch summary::-webkit-details-marker { display: none; }
.patch time { margin-left: auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.patch-body { margin-top: 10px; white-space: pre-wrap; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.none, .loading { color: var(--ink-3); margin: 0; }
.loading { text-align: center; padding: 40px 0; }
