/* ============================================================
   folio — brown & silver ASCII portfolio
   Design system + layout. Dependency-free.
   ============================================================ */

:root {
  /* --- Browns (background depth) --- */
  --brown-900: #140d07;   /* near-black espresso  */
  --brown-800: #1c130b;
  --brown-700: #241810;
  --brown-600: #2e2014;
  --brown-500: #3a291a;
  --brown-400: #4c3724;
  --brown-300: #6b4f33;

  /* --- Silvers / whites (type + UI) --- */
  --silver-100: #f6f5f2;  /* brightest */
  --silver-200: #e8e6e1;
  --silver-300: #cfcdc8;
  --silver-400: #a8a6a1;
  --silver-500: #807e7a;

  /* --- Accents --- */
  --bronze: #c9a36b;      /* warm bronze highlight */
  --bronze-dim: #8c7350;
  --glow: rgba(232, 230, 225, 0.18);
  --glow-warm: rgba(201, 163, 107, 0.22);

  --bg: var(--brown-900);
  --fg: var(--silver-200);

  --mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", "Cascadia Code",
          "Consolas", ui-monospace, Menlo, monospace;

  --maxw: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;            /* replaced by custom cursor */
  position: relative;
  min-height: 100vh;
}

/* Radial warmth so the brown isn't flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(1200px 800px at 50% -10%, var(--brown-600), transparent 60%),
    radial-gradient(900px 700px at 90% 110%, var(--brown-700), transparent 55%),
    var(--brown-900);
  pointer-events: none;
}

/* ---------- Animated ASCII background canvas ---------- */
#ascii-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.95;
}

/* ---------- CRT scanlines + flicker + vignette ---------- */
.crt {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  mix-blend-mode: overlay;
}
.crt::before {           /* scanlines */
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.0) 0px,
    rgba(0,0,0,0.0) 2px,
    rgba(0,0,0,0.22) 3px,
    rgba(0,0,0,0.0) 4px
  );
  opacity: 0.5;
}
.crt::after {            /* vignette */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,0.55) 100%);
}
.flicker { animation: flicker 6.5s infinite steps(1); }
@keyframes flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.86; }
  94% { opacity: 1; }
  96% { opacity: 0.92; }
  97% { opacity: 1; }
}

/* ---------- Custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  pointer-events: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--silver-100);
  box-shadow: 0 0 10px var(--glow), 0 0 4px var(--silver-100);
}
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid var(--bronze);
  box-shadow: 0 0 14px var(--glow-warm);
  transition: width .25s var(--ease), height .25s var(--ease),
              border-color .25s var(--ease), background-color .25s var(--ease);
}
.cursor-ring.hovering {
  width: 56px; height: 56px;
  border-color: var(--silver-100);
  background: rgba(246,245,242,0.06);
}

/* ---------- Layout ---------- */
.wrap { width: min(92vw, var(--maxw)); margin: 0 auto; }

/* no z-index here so sections can opt above the CRT scan-lines when needed */
main { position: relative; }

/* visually hidden, but readable by search engines & screen readers */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

section { padding: clamp(4rem, 12vh, 9rem) 0; position: relative; }

/* ---------- Top nav ---------- */
.topbar {
  position: absolute;   /* sits at the top of the page and scrolls away with content */
  top: 0; left: 0; right: 0;
  z-index: 120;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem clamp(1rem, 4vw, 2.4rem);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--silver-400);
  background: linear-gradient(to bottom, rgba(20,13,7,0.55), transparent);
}
.topbar .brand { color: var(--silver-200); }
.topbar .brand b { color: var(--bronze); }
.topbar .status { display: flex; gap: 1.4rem; align-items: center; }
.topbar .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #7fd18c; box-shadow: 0 0 8px #7fd18c; margin-right: 0.5rem;
  animation: pulse 2.4s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.topbar .clock { color: var(--silver-300); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: clamp(2.4rem, 7vh, 5rem);
  position: relative;
}

.ascii-name {
  font-size: clamp(0.34rem, 1.55vw, 0.92rem);
  line-height: 1.0;
  white-space: pre;
  /* solid white header */
  color: var(--silver-100);
  -webkit-text-fill-color: var(--silver-100);
  text-shadow: 0 0 16px rgba(246,245,242,0.18);
  letter-spacing: 0;
  margin: 0.4rem 0 1.2rem;
  display: inline-block;
  filter: drop-shadow(0 2px 16px rgba(0,0,0,0.5));
}

.hero h1.fallback-name {
  font-size: clamp(2.6rem, 9vw, 6.4rem);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, var(--silver-100), var(--silver-300) 55%, var(--bronze-dim));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* role + tagline now live at the top of the About section */
.intro { margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }
.intro .role {
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  color: var(--bronze);
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
.intro .role .cursor-blink { color: var(--silver-100); }
.intro .tagline {
  max-width: 62ch;
  color: var(--silver-200);
  font-size: clamp(1.05rem, 1.9vw, 1.35rem);
  line-height: 1.5;
}

/* small role caption under the name in the hero (2× smaller than the old role) */
.hero-role {
  margin-top: 1rem;
  font-size: clamp(0.72rem, 1.05vw, 0.95rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bronze);
}
.hero-role .cursor-blink { color: var(--silver-100); }

.scroll-hint {
  margin-top: 1.8rem;
  color: var(--silver-500);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.scroll-hint .arrow { animation: bob 1.8s infinite var(--ease); }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(6px)} }

.cursor-blink { animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }

/* ---------- Section heading (ASCII-flavored) ---------- */
.sec-head { margin-bottom: 2.4rem; }
.sec-head .kicker {
  color: var(--bronze-dim);
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.sec-head h2 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--silver-100);
  line-height: 1.0;
  margin-top: 0.5rem;
}
.sec-head h2 .prompt { color: var(--bronze); }

/* ---------- Terminal window panel ---------- */
/* register the glow coordinates so they can animate smoothly (no snapping) */
@property --mx { syntax: "<percentage>"; inherits: false; initial-value: 50%; }
@property --my { syntax: "<percentage>"; inherits: false; initial-value: 50%; }
@property --lit { syntax: "<number>"; inherits: false; initial-value: 0; }

.terminal {
  position: relative;
  --mx: 50%; --my: 50%; --lit: 0;
  border: 1px solid var(--brown-400);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(46,32,20,0.66), rgba(20,13,7,0.72));
  /* 4 shadow layers; the 3 glow layers start fully transparent so the lit state can
     interpolate each one smoothly (transitioning between a DIFFERENT number of layers
     is what made it snap before). No blur on the frame. */
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.8),
              inset 0 0 0 1px rgba(255,225,77,0),
              0 0 60px -6px rgba(194,77,255,0),
              0 0 80px -10px rgba(255,210,26,0);
  overflow: hidden;
  backdrop-filter: blur(3px);
  /* same mechanism + curve as the gallery tiles, so the yellow frame fades in identically */
  transition: box-shadow .7s var(--ease), border-color .7s var(--ease);
}
.terminal:hover {
  border-color: #ffe14d;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.85),
              inset 0 0 0 1px rgba(255,225,77,0.28),
              0 0 60px -6px rgba(194,77,255,0.7),
              0 0 80px -10px rgba(255,210,26,0.5);
}
.terminal .bar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--brown-500);
  background: rgba(20,13,7,0.5);
  font-size: 0.74rem;
  color: var(--silver-500);
  letter-spacing: 0.1em;
}
.terminal .bar i {
  width: 11px; height: 11px; border-radius: 50%; display: inline-block;
}
.terminal .bar .r { background: #b6553f; }
.terminal .bar .y { background: #c9a36b; }
.terminal .bar .g { background: #6f9d6a; }
.terminal .bar .title { margin-left: 0.8rem; }
.terminal .body { padding: clamp(1.2rem, 3vw, 2.2rem); }
.terminal .line { margin-bottom: 0.5rem; }
.terminal .cmd { color: var(--silver-200); }
.terminal .cmd .p { color: var(--bronze); }
.terminal .out { color: var(--silver-300); }
.terminal .out p { margin-bottom: 0.9rem; }
.terminal .out p:last-child { margin-bottom: 0; }
.terminal .muted { color: var(--silver-500); }

/* meta grid in about */
.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  margin-top: 1.6rem;
  border: 1px solid var(--brown-500);
  background: var(--brown-500);
}
.meta .cell {
  background: rgba(20,13,7,0.6);
  padding: 1rem 1.1rem;
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
.meta .cell:hover {
  background: rgba(46,32,20,0.8);
  box-shadow: inset 0 0 0 1.5px rgba(255,225,77,0.9), 0 0 30px -6px rgba(194,77,255,0.65);
}
.meta .cell:hover .k { color: #ffe14d; }
.meta .cell .k { color: var(--bronze-dim); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; }
.meta .cell .v { color: var(--silver-100); margin-top: 0.35rem; }

/* ---------- Skills / marquee strip ---------- */
.strip {
  border-top: 1px solid var(--brown-500);
  border-bottom: 1px solid var(--brown-500);
  padding: 1.1rem 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--silver-400);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.strip .track { display: inline-block; animation: scrollx 28s linear infinite; }
.strip .track span { margin: 0 1.6rem; }
.strip .track .sep { color: var(--bronze); }
@keyframes scrollx { from{transform:translateX(0)} to{transform:translateX(-50%)} }

/* ---------- Gallery ---------- */
/* lift the gallery above the CRT scan-line overlay (z-index 100) so photos stay clean */
#gallery { position: relative; z-index: 101; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 1rem;
}
/* fade-in only (no transform of 12 filtered images) -> avoids the scroll stutter */
.gallery-grid.reveal { transform: none; transition: opacity .8s var(--ease); }
.tile {
  position: relative;
  aspect-ratio: 2 / 3;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--brown-400);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brown-500), var(--brown-800));
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .5s var(--ease);
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: grayscale(0.85) sepia(0.32) brightness(0.92) contrast(1.04);
  transition: filter .6s var(--ease), transform .8s var(--ease);
}
.tile:hover {
  transform: translateY(-3px);
  border-color: #ffe14d;
  box-shadow: 0 0 0 1.5px rgba(255,225,77,0.9),
              0 0 26px 2px rgba(194,77,255,0.55),
              0 22px 50px -24px rgba(0,0,0,0.85);
}
.tile:hover img { filter: none; transform: scale(1.06); }
/* placeholder for tiles without a photo yet */
.tile.empty::before {
  content: "▦";
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--bronze-dim); font-size: 1.7rem; opacity: 0.45;
}
.tile.empty::after {
  content: "frame";
  position: absolute; left: 0; right: 0; bottom: 12px; text-align: center;
  color: var(--silver-500); font-size: 0.58rem; letter-spacing: 0.32em; text-transform: uppercase;
}
.gallery-more {
  display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 1.7rem;
  color: var(--silver-300); text-decoration: none; font-size: 0.9rem; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--brown-300); padding-bottom: 2px;
  transition: color .3s var(--ease);
}
.gallery-more:hover { color: var(--bronze); }
.gallery-more .go { color: var(--bronze); transition: transform .3s var(--ease); display: inline-block; }
.gallery-more:hover .go { transform: translateX(5px); }

@media (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Connect / links ---------- */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}
.link-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--silver-200);
  border: 1px solid var(--brown-400);
  border-radius: 10px;
  padding: 1.6rem 1.6rem;
  background: linear-gradient(180deg, rgba(34,24,15,0.86), rgba(16,10,5,0.9));
  backdrop-filter: blur(4px);
  overflow: hidden;
  transition: transform .35s var(--ease), border-color .35s var(--ease),
              box-shadow .35s var(--ease), backdrop-filter .35s var(--ease);
  will-change: transform;
}
.link-card:hover {
  border-color: #ffe14d;
  backdrop-filter: blur(9px);
  box-shadow: 0 0 0 1.5px rgba(255,225,77,0.85),
              0 0 26px 2px rgba(194,77,255,0.5),
              0 24px 60px -28px rgba(0,0,0,0.85);
}
.link-card .art {
  white-space: pre;
  font-size: 0.6rem;
  line-height: 1.05;
  color: var(--bronze-dim);
  margin-bottom: 1rem;
  transition: color .3s var(--ease);
}
.link-card:hover .art { color: var(--bronze); }
.link-card .lbl { font-size: 1.15rem; color: var(--silver-100); display: flex; justify-content: space-between; align-items: center; }
.link-card .sub { color: var(--silver-500); font-size: 0.85rem; margin-top: 0.3rem; }
.link-card .go { color: var(--bronze); transition: transform .3s var(--ease); display: inline-block; }
.link-card:hover .go { transform: translateX(6px); }

/* merged email + phone card */
.contact-lines { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; }
.contact-line {
  display: flex; align-items: center; gap: 0.65rem;
  color: var(--silver-200); text-decoration: none; font-size: 0.98rem;
  transition: color .25s var(--ease);
}
.contact-line .ic { color: var(--bronze); width: 1.1em; text-align: center; }
.contact-line:hover { color: #ffe14d; }

/* ---------- Footer ---------- */
footer {
  padding: 3rem 0 4rem;
  border-top: 1px solid var(--brown-500);
  color: var(--silver-500);
  font-size: 0.82rem;
}
footer .row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
footer .ascii-foot { white-space: pre; color: var(--bronze-dim); font-size: 0.62rem; line-height: 1.1; margin-top: 1.6rem; opacity: 0.8; }
footer a { color: var(--silver-300); text-decoration: none; border-bottom: 1px solid var(--brown-300); }
footer a:hover { color: var(--bronze); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* Elements that both reveal AND react on hover need their hover transitions preserved —
   the plain .reveal transition above would otherwise clobber them (same specificity,
   later in source). These (0,2,0) rules keep BOTH the reveal and the hover smooth. */
.terminal.reveal {
  transition: opacity .8s var(--ease), transform .8s var(--ease),
              box-shadow .7s var(--ease), border-color .7s var(--ease);
}
.link-card.reveal {
  transition: opacity .8s var(--ease), transform .35s var(--ease),
              border-color .35s var(--ease), box-shadow .35s var(--ease),
              backdrop-filter .35s var(--ease);
}

/* ---------- Selection ---------- */
::selection { background: var(--bronze); color: var(--brown-900); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  body { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }
}

/* ---------- Touch / small screens: restore native cursor ---------- */
@media (hover: none) {
  body { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }
}

@media (max-width: 640px) {
  body { cursor: auto; }
  .cursor-dot, .cursor-ring { display: none; }
  .topbar .status .clock { display: none; }
  section { padding: 4rem 0; }
}
