:root {
  --paper: #efe7d4;
  --ink: #17140f;
  --muted: #6b6455;
  --accent: #d27a58;
  --on-accent: #17140f;
  --rule: rgba(23, 20, 15, 0.9);
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

:root[data-theme="dark"] {
  --paper: #121110;
  --ink: #efe7d4;
  --muted: #9c9584;
  --accent: #c4cf8a;
  --on-accent: #121110;
  --rule: rgba(239, 231, 212, 0.85);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

::selection { background: var(--accent); color: var(--on-accent); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.35s, color 0.35s;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
:root[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.06; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 28px; }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0;
  border-bottom: 2px solid var(--rule);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}
.bar .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.55); opacity: 0.5; } }

.toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: var(--ink);
  background: none;
  border: 2px solid var(--rule);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.3s;
}
.toggle:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); transform: rotate(20deg); }
.toggle svg { grid-area: 1 / 1; width: 18px; height: 18px; transition: opacity 0.25s, transform 0.4s; }
:root[data-theme="light"] .toggle .moon { opacity: 0; transform: rotate(-60deg); }
:root[data-theme="dark"] .toggle .sun { opacity: 0; transform: rotate(60deg); }

/* hero */
.hero { position: relative; padding: 7vh 0 5vh; min-height: 62vh; }

h1 {
  font-family: var(--display);
  font-weight: 300;
  font-stretch: 75%;
  font-size: clamp(4.2rem, 20vw, 14rem);
  line-height: 0.82;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  margin: 0;
  user-select: none;
}
h1 .row { display: block; white-space: nowrap; }
h1 .ch {
  display: inline-block;
  font-variation-settings: "wght" var(--w, 300);
  transform: translateY(var(--y, 0px));
  transition: font-variation-settings 0.12s linear, transform 0.12s linear;
  will-change: transform;
}
h1 .row:nth-child(2) { color: var(--accent); }

.tagline {
  max-width: 34ch;
  margin: 34px 0 0;
  font-size: 15px;
}
.tagline b { background: var(--accent); color: var(--on-accent); font-weight: 500; padding: 0 5px; }

/* draggable stickers */
.stickers { position: absolute; right: 0; top: 4vh; width: min(440px, 48%); height: 400px; }
.sticker {
  position: absolute;
  left: 0; top: 0;
  padding: 7px 15px;
  border: 2px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  rotate: var(--r, 0deg);
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 4px 4px 0 var(--rule);
  transition: box-shadow 0.15s, background 0.15s;
}
.sticker.hot { background: var(--accent); color: var(--on-accent); }
.sticker.int { background: var(--ink); color: var(--paper); }
.sticker.drag { cursor: grabbing; box-shadow: 8px 8px 0 var(--rule); z-index: 5; }
.hint { position: absolute; right: 0; bottom: 0; font-size: 11px; color: var(--muted); }

/* marquee */
.marquee {
  border-block: 2px solid var(--rule);
  background: var(--accent);
  color: var(--on-accent);
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  text-transform: uppercase;
  transform: rotate(-1.2deg);
  margin: 4vh -3vw 6vh;
}
.marquee div { display: inline-block; padding: 10px 0; animation: slide 28s linear infinite; }
.marquee:hover div { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }

/* projects */
.label {
  display: flex; justify-content: space-between;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px;
  padding-bottom: 10px; margin: 0;
  font-weight: 400;
}
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px 18px;
  border: 2px solid var(--rule);
  background: var(--paper);
  color: inherit; text-decoration: none;
  box-shadow: 4px 4px 0 var(--rule);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}
.tile:hover, .tile:focus-visible { background: var(--accent); color: var(--on-accent); transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--rule); outline: none; }
.tile-top { display: flex; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; }
.tile .arrow { font-size: 15px; transition: transform 0.25s; }
.tile:hover .arrow { transform: translate(3px, -3px); }
.tile-title { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.05; letter-spacing: -0.02em; text-transform: uppercase; }
.tile-text { font-size: 12.5px; line-height: 1.5; }

/* note + footer */
.foot { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 9vh 0 8vh; align-items: start; }
.note {
  position: relative;
  font: inherit; color: var(--on-accent);
  text-align: left;
  background: var(--accent);
  border: 2px solid var(--rule);
  padding: 28px 26px 22px;
  rotate: -2deg;
  box-shadow: 6px 6px 0 var(--rule);
  cursor: pointer;
  transition: rotate 0.25s, transform 0.25s;
}
.note:hover { rotate: 0.6deg; transform: translateY(-4px); }
.note-text { font-family: var(--display); font-weight: 500; font-size: 22px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; transition: opacity 0.25s; }
.note-by { margin-top: 12px; font-size: 12px; min-height: 1.5em; transition: opacity 0.25s; }
.note.swap .note-text, .note.swap .note-by { opacity: 0; }
.note::after { content: "→"; position: absolute; right: 16px; bottom: 8px; font-size: 20px; line-height: 1; opacity: 0.7; transition: transform 0.25s; }
.note:hover::after { transform: translateX(4px); }

.contact h2 { font-family: var(--display); font-weight: 600; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1; letter-spacing: -0.03em; text-transform: uppercase; margin: 0 0 18px; }
.contact a { display: inline-block; margin: 0 18px 8px 0; color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--accent); text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; transition: background 0.15s, color 0.15s; }
.contact a:hover { background: var(--accent); color: var(--on-accent); }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s, transform 0.7s; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
  .hero { min-height: 0; padding: 4vh 0 2vh; }
  h1 { font-size: clamp(3rem, 17vw, 4.5rem); }
  .stickers { position: relative; width: 100%; height: 290px; top: 0; margin-top: 12px; }
  .sticker { font-size: 10.5px; padding: 0.45em 1em; box-shadow: 3px 3px 0 var(--rule); }
  .marquee { margin: 3vh -6vw 5vh; }
  .tiles { grid-template-columns: 1fr; }
  .foot { grid-template-columns: 1fr; gap: 32px; padding: 6vh 0 5vh; }
}
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Desktop: everything fits in one screen, no scrolling */
@media (min-width: 721px) and (min-height: 700px) {
  html, body { height: 100%; overflow: hidden; }
  .wrap { height: 100dvh; display: flex; flex-direction: column; padding-bottom: 10px; }
  .bar { padding: 16px 0; flex: none; }
  main { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: space-around; }
  .hero { flex: none; height: clamp(190px, 27vh, 280px); min-height: 0; padding: 0; margin-top: 0; display: flex; flex-direction: column; justify-content: center; }
  h1 { font-size: min(8vw, 5.5rem, 8.5vh); }
  .tagline { margin-top: 1.5vh; }
  .sticker { font-size: clamp(9px, 1.45vh, 12px); padding: 0.5em 1.1em; box-shadow: 3px 3px 0 var(--rule); }
  .stickers { top: 0; bottom: 30px; height: auto; width: min(640px, 54%); }
  .marquee { flex: none; margin: 0 -3vw; font-size: 20px; }
  .marquee div { padding: 7px 0; }
  .label { padding-bottom: 8px; }
  .tile { padding: 16px 18px 18px; }
  .tile-title { font-size: 1.5rem; }
  .tile-text { font-size: 13px; }
  .foot { flex: none; padding: 0; gap: 40px; align-items: center; }
  .note { padding: 22px 26px 24px; }
  .note-text { font-size: 21px; }
  .contact h2 { font-size: clamp(1.8rem, 4.5vh, 2.6rem); margin-bottom: 10px; }
}
