@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500&family=JetBrains+Mono:wght@300;400;500&family=Caveat:wght@400;500&display=swap');

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
::selection { background: var(--accent); color: var(--bg); }

/* ── TOKENS ── */
:root {
  --bg:         #0f0e0c;
  --bg-raised:  #161512;
  --bg-float:   #1c1a16;
  --text:       #e8e1d3;
  --text-mid:   #8c8478;
  --text-dim:   #3a3730;
  --accent:     #c0622d;
  --accent-2:   #4a7c6f;
  --line:       #252320;
  --pin:        #b34040;
  --serif:      'Lora', Georgia, serif;
  --mono:       'JetBrains Mono', monospace;
  --hand:       'Caveat', cursive;
  --radius:     3px;
}

body.light {
  --bg:         #f5efe3;
  --bg-raised:  #ede7d8;
  --bg-float:   #e4ddd0;
  --text:       #1a1714;
  --text-mid:   #5c5448;
  --text-dim:   #b0a898;
  --accent:     #c0622d;
  --accent-2:   #3d6b5e;
  --line:       #d8d0c4;
  --pin:        #b34040;
}

/* ── DOCUMENT ── */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.75;
  overflow-x: hidden;
  cursor: none;
  transition: background 0.08s, color 0.08s;
}

/* paper grain */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

/* light mode notebook lines */
body.light::after {
  content: '';
  position: fixed; inset: 0;
  background-image: repeating-linear-gradient(transparent, transparent 27px, rgba(0,0,0,0.022) 27px, rgba(0,0,0,0.022) 28px);
  pointer-events: none;
  z-index: 9998;
}

/* ── CURSOR ── */
#cur-dot {
  position: fixed;
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9900;
  transform: translate(-50%, -50%);
  transition: opacity 0.15s;
}

#cur-ring {
  position: fixed;
  width: 24px; height: 24px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9899;
  transform: translate(-50%, -50%);
  opacity: 0.35;
  transition: width 0.3s cubic-bezier(0.25,0,0,1),
              height 0.3s cubic-bezier(0.25,0,0,1),
              opacity 0.2s, border-color 0.2s;
}

#cur-ring.big   { width: 44px; height: 44px; opacity: 0.55; }
#cur-ring.small { width: 12px; height: 12px; opacity: 0.9; }

/* ── WIPE ── */
#wipe {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9800;
  transform: translate(-50%,-50%) scale(0);
}

/* ── SCROLL BAR ── */
#scroll-prog {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  transform-origin: top;
  transform: scaleY(0);
  z-index: 500;
  transition: transform 0.04s linear;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  padding: 0 48px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s, background 0.4s;
}

nav.stuck {
  border-color: var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
}

.nav-name {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav-name span { color: var(--accent); }

.nav-r { display: flex; align-items: center; gap: 32px; }

.nav-link {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.25s;
}

.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }

.theme-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-dim);
  width: 30px; height: 30px;
  font-size: 14px;
  cursor: none;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s, color 0.2s, transform 0.5s;
  border-radius: var(--radius);
}

.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-btn.spin { transform: rotate(180deg); }

/* ── SECTIONS ── */
section { padding: 104px 48px; max-width: 1080px; margin: 0 auto; }

/* ── HERO / TERMINAL ── */
#hero {
  min-height: 100vh;
  max-width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hero-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 52px 52px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
}

.hero-wrap {
  position: relative; z-index: 1;
  width: 100%; max-width: 720px;
  padding: 0 48px;
}

.terminal {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35), 0 0 0 1px var(--line);
}

.terminal-bar {
  padding: 10px 14px;
  background: var(--bg-float);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #e06c75; }
.dot-y { background: #d19a66; }
.dot-g { background: #4a7c6f; }

.term-title {
  margin-left: 8px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.terminal-body {
  padding: 28px 32px 36px;
  font-size: 13px;
  line-height: 1.9;
  min-height: 280px;
}

.term-line { display: flex; gap: 10px; margin-bottom: 4px; }
.prompt { color: var(--accent-2); user-select: none; flex-shrink: 0; }
.cmd { color: var(--text); }
.out { color: var(--text-mid); padding-left: 20px; display: block; margin-bottom: 2px; }
.out-hl { color: var(--text); }
.out-acc { color: var(--accent); }
.out-g { color: var(--accent-2); }
.term-cursor { display: inline-block; width: 8px; height: 1.1em; background: var(--accent); vertical-align: text-bottom; animation: blink 1s step-end infinite; margin-left: 2px; }
@keyframes blink { 0%,100%{ opacity:1; } 50%{ opacity:0; } }

.term-spacer { height: 10px; }

.hero-tagline {
  margin-top: 36px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--text-mid);
  text-align: center;
}

/* ── ABOUT ── */
#about { border-top: 1px solid var(--line); }

.about-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 72px;
  align-items: start;
}

.sec-eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sec-eyebrow::before {
  content: '';
  display: block;
  width: 28px; height: 1px;
  background: var(--accent);
}

.about-body {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.85;
  color: var(--text-mid);
}

.about-body p { margin-bottom: 18px; }
.about-body strong { color: var(--text); font-weight: 500; }
.about-body em { color: var(--accent); font-style: italic; }

.about-sidebar { display: flex; flex-direction: column; gap: 32px; }

/* handwritten note card */
.note-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
}

.note-card::before {
  content: '✦';
  position: absolute;
  top: -10px; left: 16px;
  color: var(--accent);
  font-size: 18px;
  background: var(--bg-raised);
  padding: 0 4px;
  line-height: 1;
}

.note-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.note-content {
  font-family: var(--hand);
  font-size: 17px;
  color: var(--text-mid);
  line-height: 1.6;
}

.note-content strong { color: var(--text); }

/* stack pills */
.stack-section { }
.stack-label { font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  padding: 4px 10px;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-mid);
  border-radius: var(--radius);
  transition: border-color 0.2s, color 0.2s;
}

.pill:hover { border-color: var(--accent); color: var(--accent); }

/* ── PROJECTS - CORKBOARD ── */
#projects {
  background: var(--bg-raised);
  max-width: 100%;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#projects > .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 104px 48px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 56px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 28px 26px 26px;
  position: relative;
  border-radius: 2px;
  transition: transform 0.35s cubic-bezier(0.25,0,0,1), box-shadow 0.35s;
  transform-origin: center top;
  will-change: transform;
}

/* pin */
.card::before {
  content: '';
  position: absolute;
  top: -9px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  background: var(--pin);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 -1px 0 rgba(0,0,0,0.25);
  z-index: 2;
}

/* subtle starting tilt — alternates via nth-child */
.card:nth-child(3n+1) { transform: rotate(-0.6deg); }
.card:nth-child(3n+2) { transform: rotate(0.4deg); }
.card:nth-child(3n+3) { transform: rotate(-0.3deg); }

.card:hover {
  transform: rotate(0deg) translateY(-6px) !important;
  box-shadow: 0 20px 48px rgba(0,0,0,0.3);
  z-index: 10;
}

.card-num {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.card-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.card-stack {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.card-desc {
  font-size: 12.5px;
  color: var(--text-mid);
  line-height: 1.8;
  margin-bottom: 20px;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 20px; }

.ctag {
  font-size: 9px;
  padding: 2px 8px;
  background: var(--bg-raised);
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
}

.card-link {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.2s;
}

.card-link:hover { color: var(--accent); }
.card-link svg { transition: transform 0.2s; }
.card-link:hover svg { transform: translate(2px,-2px); }

/* ── CONTACT ── */
#contact { border-top: 1px solid var(--line); }

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.contact-left { }

.contact-big {
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.contact-big em { font-style: italic; color: var(--accent); }

.contact-sub {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--text-mid);
  line-height: 1.7;
}

.contact-links { margin-top: 56px; display: flex; flex-direction: column; }

.cl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--text-mid);
  transition: color 0.2s, padding-left 0.22s cubic-bezier(0.25,0,0,1);
}

.cl:hover { color: var(--text); padding-left: 8px; }
.cl:hover .cl-arrow { color: var(--accent); transform: translate(3px,-3px); }

.cl-label { font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 2px; }
.cl-val { font-family: var(--serif); font-size: 18px; }
.cl-arrow { font-size: 18px; transition: transform 0.18s, color 0.18s; }

.contact-facts { display: flex; flex-direction: column; gap: 28px; }

.fact-group { }
.fact-label { font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.fact-val { font-family: var(--serif); font-size: 20px; color: var(--text-mid); }

/* ── TICKER ── */
.ticker-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 12px 0;
  position: relative;
}

.ticker-section::before,
.ticker-section::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 120px;
  pointer-events: none;
  z-index: 2;
}

.ticker-section::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.ticker-section::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }

.ticker-track { display: flex; width: max-content; animation: roll 32s linear infinite; }
.ticker-track:hover { animation-play-state: paused; }

.ti {
  display: flex; align-items: center; gap: 18px;
  padding: 0 18px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim); white-space: nowrap;
}

.ti::after { content: '·'; color: var(--accent); }

@keyframes roll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--line);
  padding: 28px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.foot-sig { font-family: var(--hand); font-size: 17px; color: var(--text-mid); }
.foot-sig span { color: var(--accent); }
.foot-ts { font-size: 10px; color: var(--text-dim); letter-spacing: 0.06em; }
.foot-note { font-size: 10px; color: var(--text-dim); font-style: italic; }

/* ── REVEAL ── */
.rev {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.25,0,0,1), transform 0.7s cubic-bezier(0.25,0,0,1);
}
.rev.on { opacity: 1; transform: none; }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  nav { padding: 0 24px; }
  .nav-link { display: none; }
  section { padding: 72px 24px; }
  #projects > .inner { padding: 72px 24px; }
  .about-layout { grid-template-columns: 1fr; gap: 48px; }
  .board { grid-template-columns: 1fr; }
  .card { transform: none !important; }
  .contact-layout { grid-template-columns: 1fr; gap: 48px; }
  footer { padding: 24px; flex-direction: column; align-items: flex-start; }
  #cur-dot, #cur-ring { display: none; }
  body { cursor: auto; }
}