/* =========================================================================
   Kyle Joyce — developer site
   Design system + layout + motion
   Direction: Swiss/International grid system + editorial typography.
   Flat ink/paper/red — no gradients, no blur, hard poster-style shadows.
   ========================================================================= */

:root {
  /* palette — dark by default: ink paper + a single working colour (Cork red) */
  --bg:            #131210;
  --bg-2:          #1c1a15;
  --surface:       #1b1916;
  --border:        rgba(243, 241, 234, 0.14);
  --border-strong: rgba(243, 241, 234, 0.36);

  --text:       #f3f1ea;
  --text-muted: #a8a396;
  --text-dim:   #726d5f;

  --accent:    #ff5a48; /* Cork red, brightened for dark grounds */
  --on-accent: #fff8f4;

  --shadow-ink: #d9d4c5; /* structural hard-shadow colour, theme-aware */
  --grid-line:  rgba(243, 241, 234, 0.05);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
  --pad:  clamp(20px, 5vw, 48px);

  --radius:    4px;
  --radius-sm: 2px;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --off:  6px; /* hard-shadow offset unit */
}

:root[data-theme="light"] {
  /* palette — drafting paper + ink */
  --bg:            #f6f4ee;
  --bg-2:          #ece8dc;
  --surface:       #fffefb;
  --border:        rgba(22, 21, 15, 0.16);
  --border-strong: rgba(22, 21, 15, 0.46);

  --text:       #17150f;
  --text-muted: #5c584a;
  --text-dim:   #8d8977;

  --accent: #d6291c; /* Cork red, deepened for paper grounds */

  --shadow-ink: var(--text);
  --grid-line:  rgba(22, 21, 15, 0.05);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
strong { color: var(--text); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 999;
  background: var(--text); color: var(--bg); padding: 10px 16px;
  border-radius: var(--radius-sm); font-weight: 600; transition: top .2s;
}
.skip-link:focus { top: 16px; }

/* ---------- ambient grid texture (replaces the old particle canvas) ---------- */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: repeating-linear-gradient(
    to right, var(--grid-line), var(--grid-line) 1px, transparent 1px, transparent 88px
  );
}

/* ---------- layout helpers ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(70px, 12vh, 130px) var(--pad);
}
.section__head { margin-bottom: 48px; padding-bottom: 26px; border-bottom: 1px solid var(--border); }
.section__head--sub { margin-top: 90px; margin-bottom: 34px; padding-bottom: 18px; }
.section__index {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .1em;
  color: var(--accent); display: inline-block; margin-bottom: 12px;
}
.section__index::before { content: "["; color: var(--text-dim); margin-right: 1px; }
.section__index::after { content: "]"; color: var(--text-dim); margin-left: 1px; }
.section__title {
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 2.9rem); line-height: 1.1; letter-spacing: -.02em;
}
.section__title--sm { font-size: clamp(1.35rem, 3vw, 1.7rem); }
.section__sub { color: var(--text-muted); margin-top: 14px; max-width: 46ch; }

/* ---------- navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg); border-bottom: 1px solid var(--border);
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--border-strong); box-shadow: 0 1px 0 var(--text); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 16px var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.nav__logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-head); font-weight: 600; }
.nav__mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--text); color: var(--bg); font-weight: 700; font-size: .92rem;
  transition: background .2s, color .2s;
}
.nav__logo:hover .nav__mark { background: var(--accent); color: var(--on-accent); }
.nav__name { font-size: .98rem; letter-spacing: .01em; }
.nav__links { display: flex; gap: 30px; }
.nav__links a {
  color: var(--text-muted); font-family: var(--font-head); font-size: .82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; position: relative;
  transition: color .2s;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
  background: var(--accent); transition: width .25s var(--ease);
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after { width: 100%; }
.nav__side { display: flex; align-items: center; gap: 16px; }
.nav__icon { color: var(--text-muted); transition: color .2s, transform .2s; display: grid; place-items: center; }
.nav__icon:hover { color: var(--accent); transform: translateY(-2px); }

.theme-toggle {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: color .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle__sun, .theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
:root[data-theme="light"] .theme-toggle__moon { display: block; }

.nav__toggle { display: none; background: none; border: 0; cursor: pointer; width: 40px; height: 40px; position: relative; }
.nav__toggle span {
  display: block; position: absolute; left: 9px; right: 9px; height: 2px;
  background: var(--text); transition: transform .3s var(--ease), opacity .2s;
}
.nav__toggle span:nth-child(1) { top: 14px; }
.nav__toggle span:nth-child(2) { top: 19px; }
.nav__toggle span:nth-child(3) { top: 24px; }
.nav__toggle.is-open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px; border-radius: var(--radius); font-weight: 600; font-size: .95rem;
  font-family: var(--font-head);
  cursor: pointer; border: 1.5px solid var(--text);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s, color .15s;
}
.btn--primary {
  background: var(--text); color: var(--bg);
  box-shadow: var(--off) var(--off) 0 var(--accent);
}
.btn--primary:hover { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--accent); }
.btn--ghost {
  background: var(--surface); color: var(--text);
  box-shadow: var(--off) var(--off) 0 var(--shadow-ink);
}
.btn--ghost:hover { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--shadow-ink); border-color: var(--accent); color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  max-width: var(--maxw); margin: 0 auto; padding: 120px var(--pad) 80px; position: relative;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 10px; font-family: var(--font-mono);
  font-size: .82rem; color: var(--text-muted); letter-spacing: .02em; margin-bottom: 22px;
}
.flags { display: inline-flex; gap: 5px; }
.flag-icon {
  display: block; border-radius: 2px; box-shadow: 0 0 0 1px var(--border-strong);
  transition: transform .2s var(--ease);
}
.flag-icon:hover { transform: translateY(-2px); }
.hero__eyebrow .dot {
  width: 7px; height: 7px; background: var(--accent);
  animation: blink 1.6s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .15; } }
.hero__title {
  font-family: var(--font-head); font-weight: 700; letter-spacing: -.03em;
  font-size: clamp(3rem, 11vw, 7rem); line-height: .95; margin-bottom: 8px; color: var(--text);
}
.hero__title-ga {
  display: block; font-size: clamp(1rem, 3vw, 1.5rem); font-weight: 500; font-style: italic;
  letter-spacing: -.01em; color: var(--accent); margin-top: 14px;
}
.hero__roles {
  font-family: var(--font-mono); font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  color: var(--text-muted); margin: 26px 0 20px; min-height: 1.6em;
}
.hero__roles-prefix { color: var(--text-dim); }
.typed { color: var(--text); }
.caret {
  display: inline-block; width: 3px; height: 1.05em; vertical-align: text-bottom;
  background: var(--accent); margin-left: 2px; animation: blink 1s steps(2) infinite;
}
.hero__lead { max-width: 60ch; color: var(--text-muted); font-size: clamp(1rem, 2vw, 1.15rem); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 34px; }
.hero__stats {
  list-style: none; padding: 0; margin: 60px 0 0; display: flex; flex-wrap: wrap; gap: clamp(28px, 6vw, 56px);
}
.hero__stats li { display: flex; flex-direction: column; border-left: 2px solid var(--accent); padding-left: 14px; }
.hero__stat-num {
  font-family: var(--font-head); font-weight: 700; font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--text); line-height: 1;
}
.hero__stat-label { font-size: .78rem; color: var(--text-dim); margin-top: 6px; letter-spacing: .02em; text-transform: uppercase; }

.hero__scroll {
  position: absolute; bottom: 46px; left: 50%; transform: translateX(-50%);
  width: 1px; height: 46px; background: var(--border-strong); display: none;
}
.hero__scroll::before {
  content: "SCROLL"; position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .18em; color: var(--text-dim); white-space: nowrap;
}
.hero__scroll span {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; background: var(--accent);
  animation: scrolldot 1.8s var(--ease) infinite;
}
@keyframes scrolldot { 0% { opacity: 0; top: 0; } 40% { opacity: 1; } 80% { opacity: 0; top: 40px; } 100% { opacity: 0; } }
@media (min-height: 720px) { .hero__scroll { display: block; } }

/* ---------- hard-shadow panel system (about card, project cards, skills, beyond) ---------- */
.about__card, .card, .skill-group, .beyond__item {
  background: var(--surface);
  border: 1.5px solid var(--text);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--shadow-ink);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease),
              background-color .25s var(--ease);
}
.card, .skill-group, .beyond__item { will-change: transform; }
.card:hover, .skill-group:hover, .beyond__item:hover {
  transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--accent); border-color: var(--accent);
}

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.about__body p { color: var(--text-muted); margin-bottom: 20px; font-size: 1.05rem; }
.about__card { padding: 8px 24px; position: sticky; top: 100px; }
.about__card-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.about__card-row:last-child { border-bottom: 0; }
.about__card-row span { color: var(--text-dim); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.about__card-row strong { font-size: .95rem; text-align: right; }

/* ---------- projects ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card { position: relative; padding: 26px; display: flex; flex-direction: column; }
.card--wide { grid-column: span 2; }
.card--soon { opacity: .96; }

.card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card__icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: var(--surface); border: 1.5px solid var(--text); color: var(--text);
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.card:hover .card__icon { background: var(--text); color: var(--bg); border-color: var(--accent); }
.card__icon svg { width: 26px; height: 26px; }
.card__year { font-family: var(--font-mono); font-size: .78rem; color: var(--text-dim); }
.card__badge {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 9px;
}
.card__name { font-family: var(--font-head); font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.card__tagline {
  color: var(--accent); font-size: .82rem; margin: 6px 0 14px; font-weight: 600;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .03em;
}
.card__desc { color: var(--text-muted); font-size: .96rem; flex: 1; }
.card__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 18px; }
.tag {
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-muted);
  background: transparent; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 9px;
}
.card__links { display: flex; gap: 18px; align-items: center; }
.card__link {
  display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; font-weight: 600; color: var(--text);
  transition: color .2s, gap .2s;
}
.card__link:hover { color: var(--accent); gap: 11px; }
.card__link svg { width: 16px; height: 16px; }
.card__link--muted { color: var(--text-dim); font-weight: 500; cursor: default; }

/* ---------- skills ---------- */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-group { padding: 24px; }
.skill-group h3 {
  font-family: var(--font-head); font-size: 1rem; font-weight: 600; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px; color: var(--text);
}
.skill-group h3::before { content: ""; width: 9px; height: 9px; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: .84rem; color: var(--text-muted); background: transparent;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 12px;
  transition: color .2s, border-color .2s, background .2s;
}
.chip:hover { color: var(--on-accent); border-color: var(--accent); background: var(--accent); }

/* ---------- journey watermark ---------- */
#journey { position: relative; z-index: 0; overflow: hidden; }
.journey__boat-bg {
  position: absolute; z-index: -1; pointer-events: none;
  right: 0; bottom: 0; width: clamp(380px, 42vw, 720px);
  transform: translateY(14px) rotate(-6deg);
}
.journey__boat-bg svg { width: 100%; height: auto; display: block; color: var(--text); }
#journey .journey__boat-bg.is-visible { opacity: .08; transform: rotate(-6deg); transition-duration: 1.1s; }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0; position: relative; margin: 0 auto; max-width: 780px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border-strong);
}
.tl-item { position: relative; padding: 0 0 34px 36px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 11px; height: 11px;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-date { font-family: var(--font-mono); font-size: .78rem; color: var(--accent); letter-spacing: .02em; }
.tl-title { font-family: var(--font-head); font-size: 1.12rem; font-weight: 600; margin: 3px 0 2px; }
.tl-org { color: var(--text-muted); font-size: .92rem; }
.tl-desc { color: var(--text-dim); font-size: .9rem; margin-top: 6px; }

/* ---------- beyond ---------- */
.beyond { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.beyond__item { padding: 22px 20px; }
.beyond__icon {
  width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 14px;
  border: 1.5px solid var(--text); border-radius: var(--radius-sm); color: var(--text);
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.beyond__icon svg { width: 42px; height: 42px; }
.beyond__item:hover .beyond__icon { background: var(--text); color: var(--bg); border-color: var(--accent); }
.beyond__label { font-family: var(--font-head); font-weight: 600; font-size: .98rem; }
.beyond__note { color: var(--text-dim); font-size: .84rem; margin-top: 4px; }

/* ---------- contact ---------- */
.section--contact { text-align: center; }
.contact { max-width: 640px; margin: 0 auto; }
.contact__title {
  font-family: var(--font-head); font-weight: 700; letter-spacing: -.02em;
  font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1.05; margin: 12px 0 18px; color: var(--text);
}
.contact__lead { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 34px; }
.contact__links { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); }
.footer__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 30px var(--pad);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--text-dim); font-size: .85rem;
}
.footer__made code { font-family: var(--font-mono); color: var(--accent); }

/* ---------- reveal animation ---------- */
.reveal, .reveal-child > * {
  opacity: 0; transform: translateY(14px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.reveal.is-visible, .reveal-child.is-visible > * { opacity: 1; transform: none; }
.reveal-child.is-visible > *:nth-child(2) { transition-delay: .06s; }
.reveal-child.is-visible > *:nth-child(3) { transition-delay: .12s; }
.reveal-child.is-visible > *:nth-child(4) { transition-delay: .18s; }
.reveal-child.is-visible > *:nth-child(5) { transition-delay: .24s; }
.reveal-child.is-visible > *:nth-child(6) { transition-delay: .3s; }
.reveal-child.is-visible > *:nth-child(7) { transition-delay: .36s; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-child > * { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .about__card { position: static; }
  .projects { grid-template-columns: 1fr; }
  .card--wide { grid-column: span 1; }
  .skills { grid-template-columns: 1fr 1fr; }
  .beyond { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .nav__links {
    position: fixed; inset: 0 0 auto 0; top: 69px; flex-direction: column; gap: 0;
    background: var(--bg); padding: 8px var(--pad) 20px; border-bottom: 1px solid var(--border);
    transform: translateY(-120%); opacity: 0; pointer-events: none; transition: transform .3s var(--ease), opacity .25s;
  }
  .nav__links.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav__links a { padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 1rem; }
  .nav__links a::after { display: none; }
  .nav__name { display: none; }
  .nav__toggle { display: block; }
  .skills { grid-template-columns: 1fr; }
  .beyond { grid-template-columns: 1fr 1fr; }
  .hero__stats { gap: 24px; }
}
