/* Ahmad Gesit DebyPutra, portfolio (wancu.xyz)
   Quiet gallery wall: the live apps' screenshots carry the colour,
   the running-domain index carries the type. Dark by default. */

:root {
  --paper: #121316;
  --ink: #ececea;
  --ink-2: #9a9ea6;
  --rule: #2c2e33;
  --link: #8fa3ff;
  --live: #4cc98a;
  --down: #ff8a80;
  --shade: rgba(255, 255, 255, 0.05);
  --grid: rgba(255, 255, 255, 0.04);

  --font: "Geist", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --wrap: 1200px;
  --gutter: clamp(20px, 4vw, 40px);
  color-scheme: dark;
}

[data-theme="light"] {
  --paper: #f3f3f1;
  --ink: #16171a;
  --ink-2: #5a5f67;
  --rule: #d6d7d3;
  --link: #1c3fd0;
  --live: #137a41;
  --down: #b3261e;
  --shade: rgba(20, 21, 24, 0.06);
  --grid: rgba(20, 21, 24, 0.055);
  color-scheme: light;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background 0.2s,
    color 0.2s;
}
img,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
ul {
  list-style: none;
}
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection {
  background: var(--ink);
  color: var(--paper);
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

/* ---------- Glyph field (hero background, drawn by main.js) ---------- */
.glyph-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 14px 14px;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
}
.skip:focus {
  top: 12px;
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
}
.button:hover {
  background: transparent;
  color: var(--ink);
}
.button.quiet {
  background: transparent;
  color: var(--ink);
}
.button.quiet:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Top bar ---------- */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 22px;
}
.home {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.top nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 28px);
}
.theme {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--ink-2);
}
.theme:hover {
  color: var(--ink);
  border-color: var(--ink-2);
}
.theme .i-moon,
[data-theme="light"] .theme .i-sun {
  display: none;
}
[data-theme="light"] .theme .i-moon {
  display: block;
}
.top nav a {
  color: var(--ink-2);
  text-decoration: none;
}
.top nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- Intro ---------- */
.intro {
  padding-top: clamp(32px, 7vw, 88px);
}
.intro h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}
.role {
  margin: 10px 0 28px;
  color: var(--ink-2);
}
.lead {
  font-size: clamp(1.1875rem, 2vw, 1.375rem);
  line-height: 1.45;
  max-width: 36em;
}
.lead-2 {
  color: var(--ink-2);
  max-width: 38em;
  margin-top: 14px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

/* ---------- Running domains (the one loud element) ---------- */
.running {
  padding-top: clamp(56px, 8vw, 96px);
}
.running-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--ink);
}
.running-head h2 {
  font-size: 1.125rem;
  font-weight: 600;
}
.note {
  color: var(--ink-2);
  font-size: 0.875rem;
}
.domains li {
  border-bottom: 1px solid var(--rule);
}
.domains a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
  align-items: center;
  gap: 8px 32px;
  padding: clamp(10px, 1.6vw, 18px) 0;
  color: var(--ink);
  text-decoration: none;
}
.domain {
  font-size: clamp(1.75rem, 4.6vw, 3.5rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.domain b {
  font-weight: 600;
  color: var(--ink);
}
.domains a:hover .domain b,
.domains a:focus-visible .domain b {
  color: var(--link);
}
.domains a:hover .domain,
.domains a:focus-visible .domain {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}
.what {
  font-size: 0.9375rem;
  line-height: 1.4;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 1.2em;
}
.status:not(:empty)::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-2);
  transition:
    background 0.3s,
    border-color 0.3s;
}
.status[data-state="up"] {
  color: var(--live);
}
.status[data-state="up"]::before {
  background: var(--live);
  border-color: var(--live);
}
.status[data-state="down"] {
  color: var(--down);
}
.status[data-state="down"]::before {
  border-color: var(--down);
}
.new {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0;
  vertical-align: 0.2em;
}

/* ---------- Section titles ---------- */
.section-title {
  font-size: clamp(1.875rem, 3.6vw, 2.75rem);
  letter-spacing: -0.035em;
  font-weight: 600;
}

/* ---------- Projects ---------- */
.projects {
  padding-top: clamp(80px, 12vw, 152px);
}
.group-title {
  margin-top: clamp(40px, 6vw, 64px);
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--ink);
  font-size: 1.125rem;
  font-weight: 600;
}
.project {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px clamp(24px, 4vw, 48px);
  align-items: start;
  padding: clamp(32px, 5vw, 56px) 0;
  border-bottom: 1px solid var(--rule);
}
.project h4 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}
.project h4 .new {
  margin-left: 6px;
}
.project-text > p {
  max-width: 34em;
}
.shots {
  display: flex;
  gap: 12px;
}
.shots img {
  flex: 1.6 1 0;
  min-width: 0;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  border-radius: 6px;
  outline: 1px solid var(--shade);
  outline-offset: -1px;
  background: var(--shade);
  box-shadow: 0 1px 0 var(--rule);
}
.shots img.tall {
  flex: 0.5625 1 0;
  aspect-ratio: 9 / 16;
}

.did {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  font-size: 0.9375rem;
}
.did li {
  position: relative;
  padding-left: 18px;
}
.did li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.68em;
  width: 7px;
  height: 1.5px;
  background: var(--ink-2);
}
.stack {
  margin-top: 16px;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 22px;
}
.hint {
  color: var(--ink-2);
  font-size: 0.875rem;
}

/* featured: images across the full width, text split underneath */
.project.featured {
  grid-template-columns: 1fr;
}
.project-body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px clamp(24px, 4vw, 48px);
}
.project-body .did {
  margin-top: 0;
}

/* small: a single line of text and an action */
.project.small {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.project.small h4 {
  font-size: 1.375rem;
  margin-bottom: 6px;
}
.project.small .links {
  margin-top: 0;
}

/* ---------- Infrastructure ---------- */
.infra {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px clamp(24px, 4vw, 48px);
  padding-top: clamp(80px, 12vw, 152px);
}
.infra-body > p {
  font-size: 1.1875rem;
  line-height: 1.45;
  max-width: 30em;
  margin-bottom: 22px;
}
.facts div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 4px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.facts dt {
  font-weight: 600;
}
.facts dd {
  color: var(--ink-2);
}

/* ---------- Contact ---------- */
.contact {
  padding-top: clamp(80px, 12vw, 152px);
}
.contact-lead {
  margin-top: 16px;
  max-width: 34em;
  color: var(--ink-2);
}
.email {
  display: inline-block;
  margin-top: 20px;
  color: var(--ink);
  font-size: clamp(1.625rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration-thickness: 2px;
}
.email:hover {
  color: var(--link);
}
.channels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 22px;
}
.text-button {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.text-button:hover {
  text-decoration-thickness: 2px;
}

/* ---------- Footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  margin-top: clamp(80px, 12vw, 152px);
  padding-top: 20px;
  padding-bottom: 32px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.875rem;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9375rem;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Dino Runner modal ---------- */
.dino-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}
.dino-modal[hidden] {
  display: none;
}
.dino-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 12, 0.6);
}
.dino-panel {
  position: relative;
  width: min(920px, 100%);
  padding: 18px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.dino-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.dino-title {
  font-size: 1.125rem;
  font-weight: 600;
}
.dino-scores {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.dino-scores strong {
  margin-left: 4px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dino-sfx,
.dino-x {
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--ink);
}
.dino-sfx:hover,
.dino-x:hover {
  border-color: var(--ink);
}
.dino-x {
  width: 36px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}
#dinoCanvas {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
  touch-action: manipulation;
  cursor: pointer;
}
.dino-touch {
  display: none;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.dino-touch button {
  flex: 1;
  max-width: 180px;
  padding: 14px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.dino-touch button:active {
  background: var(--ink);
  color: var(--paper);
}
@media (hover: none), (max-width: 640px) {
  .dino-touch {
    display: flex;
  }
}
.dino-help {
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 0.875rem;
}
body.dino-open {
  overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .project,
  .project-body,
  .infra {
    grid-template-columns: 1fr;
  }
  .domains a {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
@media (max-width: 600px) {
  body {
    font-size: 1rem;
  }
  .top nav a[download] {
    display: none;
  }
  .shots {
    flex-direction: column;
  }
  .shots img,
  .shots img.tall {
    flex: none;
    width: 100%;
  }
  .shots img.tall {
    display: none;
  }
  .project.small {
    grid-template-columns: 1fr;
  }
  .facts div {
    grid-template-columns: 1fr;
  }
  .dino-scores {
    gap: 10px;
    font-size: 0.875rem;
  }
}

/* ---------- Print ---------- */
@media print {
  .glyph-field,
  .top nav,
  .actions,
  .links .button,
  .dino-modal,
  .toast,
  .skip,
  .channels .text-button {
    display: none !important;
  }
  :root,
  [data-theme="light"] {
    --paper: #fff;
    --ink: #000;
    --ink-2: #444;
  }
}
