/* =========================================================================
   robertyoung.ie · terminal · amber · dark default, light on request
   Hand-built, dependency-light. Two web fonts (IBM Plex), no JS framework.
   Fonts are self-hosted from fonts/ — latin subset, same files Google serves.
   ========================================================================= */

/* ------------------------------------------------------------------ fonts */

/* Sans is a variable font: one file covers every weight on the page. */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Mono ships as static instances — one file per weight. */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", "JetBrains Mono", Menlo,
          Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;

  /* Dark palette: warm charcoal, off-white ink, single amber signal */
  --bg:        #111210;
  --panel:     #0d0e0c;
  --ink:       #f3f1e8;
  --ink-soft:  #c4c2b7;
  --muted:     #8b8a7e;
  --faint:     #828176;
  --rule:      #26271f;
  --rule-soft: #1d1e18;
  --accent:    #e0a64a;
  --accent-dim:#b9854f;

  /* Text colour for the amber chips (.mark, .skip-link) — flips in light mode,
     where the accent darkens and near-black would drop to 2.9:1. */
  --on-accent: #111210;

  --sidebar: 300px;
  --shell-max: 1400px;
}

/* Light mode: not an inversion. The dark-mode amber (#e0a64a) is only 2:1 on a
   light background, so the accent darkens to #8a5a12 and the chips take light text. */
@media (prefers-color-scheme: light) {
  :root {
    --bg:        #faf8f2;
    --panel:     #f2efe6;
    --ink:       #1b1c18;
    --ink-soft:  #3f4038;
    --muted:     #63645a;
    --faint:     #65665c;
    --rule:      #dedbd0;
    --rule-soft: #e8e5da;
    --accent:    #8a5a12;
    --accent-dim:#8a5a12;
    --on-accent: #faf8f2;
  }
}

/* ------------------------------------------------------------------ reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.97rem + 0.18vw, 1.0625rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, dl, dd, dt { margin: 0; }
ul { padding: 0; list-style: none; }

a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: rgba(224, 166, 74, 0.28); color: var(--ink); }

/* --------------------------------------------------------------- skip link */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.55rem 0.9rem;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  z-index: 20;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ------------------------------------------------------------------ shell */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100vh;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2.9rem 2rem 2.4rem;
  background: var(--panel);
  border-right: 1px solid var(--rule);
}

.mark {
  display: inline-flex;
  width: 2.15rem;
  height: 2.15rem;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sidebar-id { margin-top: 1.5rem; }
.sidebar-name {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.sidebar-role {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 0.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
  margin-top: 2.9rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.sidebar-nav a {
  color: var(--muted);
  width: max-content;
  white-space: nowrap;
}
.sidebar-nav a::before { content: "// "; color: var(--accent-dim); }
.sidebar-nav a:hover { color: var(--accent); }

.sidebar-links {
  margin-top: auto;
  padding-top: 2.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.sidebar-links a { color: var(--ink-soft); width: max-content; white-space: nowrap; }
.sidebar-links a::before { content: "\2192\00a0\00a0"; color: var(--accent-dim); }
.sidebar-links a:hover { color: var(--accent); }
.sidebar-colophon {
  margin-top: 1.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}

/* ------------------------------------------------------------------ main */

.content {
  padding: clamp(2.8rem, 4.5vw, 4.6rem) clamp(1.6rem, 4vw, 4rem)
           clamp(3rem, 5vw, 4.6rem);
  max-width: 60rem;
}

/* hero */

.hero { padding-bottom: clamp(2.6rem, 4vw, 3.8rem); }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 1.6rem;
}
.hero h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(3.1rem, 8vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.hero .role {
  font-family: var(--mono);
  font-size: clamp(1rem, 2.1vw, 1.22rem);
  font-weight: 400;
  color: var(--ink-soft);
  margin-top: 1.25rem;
  letter-spacing: -0.01em;
}
.hero .role .amp { color: var(--accent); }

.hero .lede {
  font-size: clamp(1.18rem, 2.2vw, 1.42rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 40ch;
  margin-top: 1.9rem;
}

/* sections */

.section {
  padding: clamp(2.4rem, 3.6vw, 3.2rem) 0;
  border-top: 1px solid var(--rule);
}

.marker {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.marker::before { content: "// "; color: var(--accent-dim); }

.section p { max-width: 64ch; color: var(--ink-soft); }
.section p + p { margin-top: 1.1rem; }

/* stack */

.stack { display: grid; gap: 0; font-family: var(--mono); }
.stack-row {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0 2rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule-soft);
  align-items: baseline;
}
.stack-row:last-child { border-bottom: 0; }
.stack-key { color: var(--muted); font-size: 0.86rem; }
.stack-val { color: var(--ink); font-size: 0.92rem; line-height: 1.55; }

/* recent work */

.work { display: grid; gap: 1.35rem; }
.work li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: baseline;
}
.work .idx {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
}
.work .body { color: var(--ink-soft); line-height: 1.6; }

/* background */

.credentials {
  margin-top: 1.3rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.7;
}

/* research */

.papers { display: grid; gap: 1.5rem; }
.papers .paper-title {
  font-size: 1.08rem;
  line-height: 1.4;
  color: var(--ink);
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.papers a.paper-title:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.paper-meta {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
}
.more {
  margin-top: 1.7rem;
  font-family: var(--mono);
  font-size: 0.84rem;
}
.more a { color: var(--accent); }
.more a:hover { color: var(--ink); }

/* ------------------------------------------------------ responsive (mobile) */

@media (max-width: 56rem) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem 1.6rem;
    padding: 1.5rem clamp(1.6rem, 5vw, 2.2rem);
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .sidebar-id { margin-top: 0; }
  .sidebar-nav { display: none; }
  .sidebar-links {
    margin-top: 0;
    padding-top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem 1.3rem;
    margin-left: auto;
  }
  .sidebar-colophon { display: none; }
}

@media (max-width: 34rem) {
  .stack-row { grid-template-columns: 1fr; gap: 0.2rem; }
  .sidebar-links { width: 100%; margin-left: 0; }
}

/* --------------------------------------------------- entrance motion
   Content is fully visible by default; fade-in only when motion is welcome.
   Anchor scrolling is gated here too — smooth scroll is a vestibular trigger. */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .reveal {
    opacity: 0;
    transform: translateY(0.6rem);
    animation: rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .sidebar.reveal            { animation-delay: 0.02s; }
  .hero.reveal               { animation-delay: 0.08s; }
  .section.reveal:nth-of-type(1) { animation-delay: 0.16s; }
  .section.reveal:nth-of-type(2) { animation-delay: 0.22s; }
  .section.reveal:nth-of-type(3) { animation-delay: 0.28s; }
  .section.reveal:nth-of-type(4) { animation-delay: 0.34s; }
  .section.reveal:nth-of-type(5) { animation-delay: 0.40s; }

  @keyframes rise { to { opacity: 1; transform: none; } }
}
