/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --muted: #5f5f66;
  --line: #e2e2e6;
  --hover: #f3f3f5;
  --card: rgba(255, 255, 255, 0.86);
  --glow: rgba(70, 80, 120, 0.22);
  --w1: rgba(110, 110, 125, 0.1); /* wave shades */
  --w2: rgba(110, 110, 125, 0.14);
  --w3: rgba(110, 110, 125, 0.2);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.08), 0 16px 40px rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glow: rgba(190, 200, 255, 0.24);
    --bg: #0e0e0f;
    --ink: #f2f2f4;
    --muted: #a0a0aa;
    --line: #2a2a30;
    --hover: #1a1a1e;
    --card: rgba(14, 14, 15, 0.86);
    --w1: rgba(255, 255, 255, 0.04);
    --w2: rgba(255, 255, 255, 0.07);
    --w3: rgba(255, 255, 255, 0.11);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.55);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.6), 0 18px 44px rgba(0, 0, 0, 0.65);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --glow: rgba(190, 200, 255, 0.24);
  --bg: #0e0e0f;
  --ink: #f2f2f4;
  --muted: #a0a0aa;
  --line: #2a2a30;
  --hover: #1a1a1e;
  --card: rgba(14, 14, 15, 0.86);
  --w1: rgba(255, 255, 255, 0.04);
  --w2: rgba(255, 255, 255, 0.07);
  --w3: rgba(255, 255, 255, 0.11);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.6), 0 18px 44px rgba(0, 0, 0, 0.65);
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* ---------- Base ---------- */
html {
  background: var(--bg);
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Wave background (drawn by script.js) */
#wall {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Layout ---------- */
main {
  position: relative;
  z-index: 1;
  width: min(94vw, 140dvh);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

/* ---------- Intro ---------- */
.pic {
  --size: clamp(88px, min(7vw, 12dvh), 150px);
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--hover);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 2.2rem;
  font-weight: 600;
}
.pic img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1 {
  margin: 0;
  font-size: clamp(2.25rem, min(3vw, 5dvh), 4rem);
  line-height: 1.2;
  font-weight: 700;
}

.sub {
  margin: 0.25rem 0 1rem;
  color: var(--muted);
  font-size: clamp(1.15rem, min(1.4vw, 2.4dvh), 1.8rem);
}

.mail {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: clamp(1rem, min(1.1vw, 2dvh), 1.4rem);
}
.mail:hover {
  background: var(--hover);
}

.btns {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.75rem 0 clamp(1.75rem, min(3vw, 4.5dvh), 3rem);
}
.btn {
  display: grid;
  place-items: center;
  width: clamp(44px, min(3.2vw, 5.5dvh), 64px);
  height: clamp(44px, min(3.2vw, 5.5dvh), 64px);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.btn:hover {
  background: var(--hover);
  border-color: var(--muted);
}

.ico {
  width: 1.3rem;
  height: 1.3rem;
  fill: currentColor;
  flex: none;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover {
  background: var(--hover);
  border-color: var(--muted);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.theme-toggle svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Light shows the moon (switch to dark); dark shows the sun (switch to light) */
.theme-toggle .i-sun {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .i-moon {
    display: none;
  }
}
:root[data-theme="dark"] .theme-toggle .i-sun {
  display: block;
}
:root[data-theme="dark"] .theme-toggle .i-moon {
  display: none;
}

/* ---------- App cards ---------- */
.apps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.25rem, 2vw, 2.5rem);
  text-align: left;
}

.app {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
     box-shadow: var(--shadow);
}
.app:hover,
.app:focus-visible {
  transform: scale(1.03);
  border-color: var(--glow);
  box-shadow: 0 0 18px 2px var(--glow), var(--shadow-hover);  /* was: ..., 0 10px 30px rgba(0,0,0,.16) */
  position: relative;
  z-index: 2;
}

/* Artwork (image or video): greyscale until hovered */
.art {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  filter: grayscale(1);
  transition: filter 0.2s ease;
}
.app:hover .art,
.app:focus-visible .art {
  filter: none;
}

.app > div {
  padding: 1rem 1.1rem 1.15rem;
}
.app b {
  display: block;
  font-size: clamp(1.2rem, min(1.5vw, 2.6dvh), 1.9rem);
}
.app span {
  color: var(--muted);
  font-size: clamp(1rem, min(1.1vw, 2dvh), 1.4rem);
}

.role {
  display: block;
  width: fit-content;
  margin: 0.4rem 0 0.6rem;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-style: normal;
  font-size: clamp(0.8rem, min(0.9vw, 1.7dvh), 1.1rem);
  color: var(--muted);
}

/* ---------- Responsive / motion ---------- */
/* Desktop: fit everything in one screen (avoids a scrollbar); art fills the leftover height */
@media (min-width: 901px) and (min-aspect-ratio: 13/10) and (min-height: 520px) {
  main {
    height: 100dvh;
    min-height: 0;
    justify-content: flex-start;
    padding: clamp(1rem, 3dvh, 2.5rem) 0;
  }
  .apps {
    flex: 1;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }
  .app {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .art {
    flex: 1 1 0;
    min-height: 0;
    aspect-ratio: auto;
  }
  .app > div {
    flex: none;
  }
}

/* Stacked: narrow windows, or windows too square/tall for side-by-side art */
@media (max-width: 900px), (max-aspect-ratio: 13/10) {
  .apps {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 44rem;
    margin-inline: auto;
  }
  main {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app {
    transition: none;
  }
  .app:hover,
  .app:focus-visible {
    transform: none;
  }
}
