/* ============================================================
   Tim — personal page
   Hand-written. Tokens first, then sections. No magic numbers.
   ============================================================ */

:root {
  color-scheme: light only;   /* opt out of browser auto dark-mode inversion */
  /* Color: neutral light grey, near-black ink, one rust accent. */
  --paper:      #f5f4f2;
  --paper-2:    #ebebe8;
  --ink:        #1f1f1e;
  --ink-soft:   #424241;
  --muted:      #7c7c79;
  --accent:     #f3631a;
  --accent-ink: #b8400a;
  --rule:       #d1d1ce;

  /* Type: a contemporary grotesque pairing. Not Inter, not a serif. */
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system,
          "Segoe UI", Roboto, sans-serif;

  /* Type scale — fluid. */
  --step--1: clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1.02rem, 0.98rem + 0.22vw, 1.16rem);
  --step-1:  clamp(1.25rem, 1.15rem + 0.45vw, 1.55rem);
  --step-2:  clamp(1.55rem, 1.35rem + 0.95vw, 2.20rem);
  --step-3:  clamp(2.00rem, 1.65rem + 1.80vw, 3.10rem);
  --step-4:  clamp(2.60rem, 2.00rem + 3.10vw, 4.60rem);

  /* Spacing scale. */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2.5rem;
  --s-5: 4rem;
  --s-6: 6rem;

  --measure: 38rem;
  --wide: 62rem;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--paper);
  /* fine newsprint-style halftone dots, inline so there's no asset to host */
  background-image:
    radial-gradient(rgba(31, 31, 30, 0.035) 0.5px, transparent 0.7px),
    radial-gradient(rgba(31, 31, 30, 0.025) 0.5px, transparent 0.7px);
  background-size: 4px 4px, 4px 4px;
  background-position: 0 0, 2px 2px;
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

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

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: var(--s-1) var(--s-2); }
.skip:focus { left: var(--s-2); top: var(--s-2); z-index: 10; }

/* ---------- frame ---------- */
main, .site-foot { width: min(100% - 2.5rem, var(--wide)); margin-inline: auto; }
section[id] { scroll-margin-top: 5.5rem; }

/* ---------- header (sticky) ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 244, 242, 0.82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-head-inner {
  width: min(100% - 2.5rem, var(--wide)); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) 0; gap: var(--s-3);
}
.mark { font-family: var(--display); font-size: var(--step-1); font-weight: 700; letter-spacing: -0.01em; }
.site-nav { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 1rem; letter-spacing: 0.01em; }
.site-nav a:hover { color: var(--ink); }

/* ---------- intro / hero with photo ---------- */
.intro {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-6) 0;
}
/* soft ambient glow behind the hero, gently breathing */
.intro::before {
  content: "";
  position: absolute; z-index: -1; pointer-events: none;
  top: -8%; right: -6%; width: 58%; height: 95%;
  background: radial-gradient(circle, rgba(243, 99, 26, 0.16), transparent 65%);
  filter: blur(34px);
  animation: glow-pulse 7s ease-in-out infinite;
}

/* coloured key words */
.hl { color: var(--accent-ink); font-weight: 600; }
h1 .hl { font-weight: inherit; }
.eyebrow {
  font-size: var(--step--1); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--s-3);
}
h1 { font-size: var(--step-4); letter-spacing: -0.02em; }
.lede { margin-top: var(--s-3); max-width: var(--measure); font-size: var(--step-1); color: var(--ink-soft); line-height: 1.5; }

.portrait { margin: 0; position: relative; }
.portrait img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 12px 22px rgba(33, 31, 26, 0.16));
}
.portrait-hint { display: none; }
.portrait.no-photo {
  display: grid; place-items: center; text-align: center;
  aspect-ratio: 4 / 5; border: 1px dashed var(--accent); border-radius: var(--radius);
  background: var(--paper-2); color: var(--muted);
}
.portrait.no-photo .portrait-hint { display: block; font-size: var(--step--1); }
.portrait.no-photo code { color: var(--accent-ink); }

/* ---------- blocks ---------- */
.block { padding: var(--s-6) 0; border-top: 1px solid var(--rule); }
.block-head { margin-bottom: var(--s-4); }
.block h2 { font-size: var(--step-2); letter-spacing: -0.01em; }
.block h2::before {
  content: ""; display: block;
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--accent);
  margin-bottom: var(--s-2);
}
.block-note { color: var(--muted); margin-top: var(--s-1); max-width: var(--measure); }

/* ---------- skills ---------- */
.skills {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  max-width: 48rem;
}
.skills li {
  border: 1px solid rgba(243, 99, 26, 0.30); border-radius: 100px;
  padding: 0.4rem 1.05rem; font-size: var(--step--1); color: var(--ink);
  background: rgba(243, 99, 26, 0.07);
}
.skills .ph-li { border-style: dashed; border-color: var(--accent); color: var(--accent-ink); background: transparent; }

/* ---------- work / experience / education / projects ---------- */
.work { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.work-item {
  display: grid; grid-template-columns: 11rem 1fr; gap: var(--s-4);
  padding: var(--s-4);
  background: #faf9f7;
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.work-meta { display: flex; flex-direction: column; gap: var(--s-1); }
.work-year { color: var(--accent-ink); font-weight: 600; font-size: var(--step--1); letter-spacing: 0.02em; }
.work-tag {
  align-self: start; font-size: var(--step--1); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 100px; padding: 0.1rem 0.7rem;
}
.work-body h3 { font-size: var(--step-1); margin-bottom: 0.3rem; }
.work-org { color: var(--muted); margin-bottom: var(--s-2); }
.work-body p { max-width: var(--measure); color: var(--ink-soft); }
.duties { margin: 0; padding-left: 1.15rem; max-width: var(--measure); color: var(--ink-soft); }
.duties li { margin-bottom: 0.4rem; }
.duties li:last-child { margin-bottom: 0; }
.duties li::marker { color: var(--accent); }

/* collapsible work cards */
.work-item.collapsible .duties li:nth-child(n+3) { display: none; }
.work-item.collapsible.open .duties li:nth-child(n+3) { display: list-item; animation: rise .35s ease both; }
.toggle {
  grid-column: 1 / -1;
  margin: var(--s-3) auto 0; padding: 0.2rem 0.4rem; width: fit-content;
  background: none; border: none; cursor: pointer;
  font-family: var(--body); font-weight: 600; font-size: var(--step--1);
  color: var(--accent-ink);
  display: flex; align-items: center; gap: 0.4rem;
  transition: transform .12s ease, text-shadow .25s ease, color .25s ease;
}
.toggle:hover { color: var(--accent); text-shadow: 0 0 12px rgba(243, 99, 26, 0.55); }
.toggle:active { transform: scale(0.9); }
.toggle::after { content: "\25BE"; transition: transform .25s ease; }
.work-item.open .toggle::after { transform: rotate(180deg); }
.ph-block { opacity: 0.85; }

/* ---------- contact ---------- */
.contact-lede { max-width: var(--measure); color: var(--ink-soft); margin-bottom: var(--s-4); }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.links a { font-family: var(--display); font-weight: 600; font-size: var(--step-2); text-decoration: none; color: var(--ink); display: inline-block; }
.links a:hover { color: var(--accent-ink); }

/* placeholder marker */
.ph { font-family: var(--body); font-size: 0.7rem; color: #fff; background: var(--accent);
      padding: 0.05rem 0.4rem; border-radius: 3px; vertical-align: middle; letter-spacing: 0; font-weight: 500; }

/* ---------- footer ---------- */
.site-foot { padding: var(--s-5) 0 var(--s-4); border-top: 1px solid var(--rule); margin-top: var(--s-5); color: var(--muted); font-size: var(--step--1); }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

@keyframes glow-pulse {
  0%, 100% { opacity: .45; transform: scale(1); }
  50%      { opacity: .85; transform: scale(1.06); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* hero load-in */
.intro-text { animation: rise .8s ease both; }
.portrait   { animation: rise .8s ease .12s both; }

/* hover glows across interactive elements */
.site-nav a { transition: color .25s ease, text-shadow .25s ease; }
.site-nav a:hover { color: var(--accent-ink); text-shadow: 0 0 12px rgba(243, 99, 26, 0.40); }

.skills li { transition: transform .2s ease, box-shadow .25s ease, border-color .25s ease, color .25s ease, background .25s ease; }
.skills li:hover {
  transform: translateY(-2px); color: var(--ink); border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(243, 99, 26, 0.45), 0 8px 22px -8px rgba(243, 99, 26, 0.5);
}

.work-item { transition: transform .25s ease, box-shadow .3s ease, border-color .25s ease; }
.work-item:hover {
  transform: translateY(-3px); border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(243, 99, 26, 0.30), 0 16px 34px -16px rgba(243, 99, 26, 0.45);
}
.work-item:hover .work-tag { box-shadow: 0 0 14px -2px rgba(243, 99, 26, 0.45); }

.links a { transition: color .25s ease, text-shadow .25s ease, transform .2s ease; }
.links a:hover { color: var(--accent-ink); text-shadow: 0 0 18px rgba(243, 99, 26, 0.35); transform: translateX(3px); }

.portrait img { transition: filter .4s ease; }
.portrait:hover img { filter: drop-shadow(0 16px 30px rgba(243, 99, 26, 0.28)); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .intro::before, .intro-text, .portrait { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- narrow ---------- */
@media (max-width: 46rem) {
  .intro { grid-template-columns: 1fr; gap: var(--s-4); padding: var(--s-5) 0; }
  .portrait { max-width: 18rem; order: -1; }
  .work-item { grid-template-columns: 1fr; gap: var(--s-2); }
  .site-head-inner { flex-wrap: wrap; gap: var(--s-2); }
  .site-nav { gap: var(--s-3); }
}
