@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url("fonts/space-mono.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* Design tokens. Muted text passes WCAG AA on both backgrounds. */
:root {
  --bg: #f7f7f5;
  --fg: #0b0b0c;
  --muted: #5e5e63;
  --line: rgba(11, 11, 12, 0.14);
  --accent: #ff4d1c;
  --c0: #e8e8e4;
  --c1: #ffd9cc;
  --c2: #ffaa8c;
  --c3: #ff7a4d;
  --c4: #ff4d1c;
  --surface: #ffffff;
  --sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --fg: #f2f2f0;
  --muted: #9a9aa0;
  --line: rgba(242, 242, 240, 0.14);
  --c0: #19191b;
  --c1: #4a1f12;
  --c2: #7a2e15;
  --c3: #c23d17;
  --surface: #151517;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.01em;
}
.muted {
  color: var(--muted);
}

/* Layout: header / name / grid / projects / footer. */
.page {
  min-height: 100svh;
  max-width: 1200px;
  margin: 0 auto;
  padding: max(var(--gutter), env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  gap: clamp(24px, 4vh, 48px);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.controls {
  display: flex;
  gap: 8px;
}
.chip {
  font-family: var(--mono);
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 32px;
  min-width: 44px;
  padding: 0 10px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s;
}
.chip:hover {
  border-color: var(--fg);
}

.hero {
  align-self: center;
}
.name {
  margin: 0;
  font-weight: 700;
  font-size: clamp(3.4rem, 20vw, 10rem);
  line-height: 0.88;
  letter-spacing: -0.045em;
}
.tagline {
  margin: clamp(14px, 2.5vh, 24px) 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  color: var(--muted);
}

/* Decorative contribution-style grid. Columns are set from JS to fit the width. */
.grid {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: clamp(2px, 0.35vw, 4px);
  cursor: pointer;
}
.grid i {
  display: block;
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--c0);
  transition:
    background-color 0.35s ease,
    transform 0.15s ease;
}
.grid i.l1 {
  background: var(--c1);
}
.grid i.l2 {
  background: var(--c2);
}
.grid i.l3 {
  background: var(--c3);
}
.grid i.l4 {
  background: var(--c4);
}
@media (hover: hover) {
  .grid i:hover {
    background: var(--accent);
    transform: scale(1.5);
  }
}

.bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.links {
  display: flex;
  gap: 20px;
}
.links a,
.linklike {
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  border-bottom: 1px solid transparent;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.links a:hover,
.linklike:hover {
  border-bottom-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  margin: 0;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.toast.sticky {
  pointer-events: auto;
  user-select: all;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Command menu */
.palette {
  width: min(520px, calc(100vw - 32px));
  margin: 18vh auto auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--fg);
}
.palette::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}
.palette-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font: 16px var(--sans);
  padding: 16px 18px;
  outline: none;
}
.palette-input:focus-visible {
  box-shadow: inset 0 -2px 0 var(--accent);
}
.palette-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 50vh;
  overflow: auto;
}
.palette-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.palette-list li {
  border-left: 2px solid transparent;
}
.palette-list li[aria-selected="true"] {
  background: var(--line);
  border-left-color: var(--accent);
}
.palette-list li .hint {
  color: var(--muted);
}
.palette-foot {
  margin: 0;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

/* Projects: private for now, public ones coming soon. */
.projects .label {
  margin: 0 0 12px;
  font-weight: 400;
}
.soon-line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 15px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}
.lock {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}
.cursor {
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

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

/* Circular theme reveal (View Transitions API, where supported). */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* Keyboard hints mean nothing on touch screens. */
@media (pointer: coarse) and (hover: none) {
  .palette-foot {
    display: none;
  }
}
