/* ============================================================
   Evan Riggs — personal site
   Minimal, dark, single-column. Inter for UI, Newsreader for
   the occasional italic accent.
   ============================================================ */

/* self-hosted fonts (latin subsets) — no third-party requests */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("assets/fonts/inter-latin.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: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/newsreader-italic-latin.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 {
  --bg: #0e0e0e;
  --ink: #ececec;
  --ink-dim: #9a9a9a;
  --ink-faint: #6b6b6b;
  --hairline: rgba(255, 255, 255, 0.09);
  --accent: #e8dcc8; /* warm bone — used sparingly */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --serif: "Newsreader", Georgia, serif;
}

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

/* visually hidden, available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { scrollbar-gutter: stable; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 450;
  line-height: 1.65;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint vignette so the page doesn't feel flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,0.035), transparent 55%);
}

/* film grain — barely-there animated noise so the dark ground reads
   as texture, not a dead screen */
body::after {
  content: "";
  position: fixed;
  inset: -100%;
  pointer-events: none;
  z-index: 9;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(8) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  12.5%{ transform: translate(-4%, -6%); }
  25%  { transform: translate(3%, -12%); }
  37.5%{ transform: translate(-8%, 4%); }
  50%  { transform: translate(6%, 9%); }
  62.5%{ transform: translate(-11%, -3%); }
  75%  { transform: translate(9%, -8%); }
  87.5%{ transform: translate(-3%, 11%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
}

/* ---------- persistent-layout transitions ----------
   The name and the three section labels exist in every view and carry
   stable view-transition-names, so navigation reads as the page
   rearranging itself: labels glide from the home index into the
   compact header nav, the name shrinks from masthead to crumb. */

.masthead h1, .crumb .back { view-transition-name: site-name; }
.index-row[href="#/work"] .index-title, .topnav a[href="#/work"] { view-transition-name: nav-work; }
.index-row[href="#/writing"] .index-title, .topnav a[href="#/writing"] { view-transition-name: nav-writing; }
.index-row[href="#/contact"] .index-title, .topnav a[href="#/contact"] { view-transition-name: nav-contact; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}

::view-transition-group(*) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* views entered via a morph transition skip the stagger — the moving
   fixtures are the animation */
.view.no-reveal .reveal {
  animation: none;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

#app {
  margin: 0 auto;
  padding: clamp(4rem, 12vh, 8.5rem) 1.5rem 5rem;
}

.view {
  max-width: 620px;
  margin: 0 auto;
}

/* work view breaks out wider for the two-column resume */
.view[data-view="work"] { max-width: 960px; }
.work-intro { max-width: 620px; margin: 0 auto; }

::selection { background: var(--accent); color: #111; }

a { color: inherit; }

/* ---------- reveal (staggered entrance) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.9s var(--ease) forwards;
}
.reveal:nth-child(1) { animation-delay: 0.05s; }
.reveal:nth-child(2) { animation-delay: 0.13s; }
.reveal:nth-child(3) { animation-delay: 0.21s; }
.reveal:nth-child(4) { animation-delay: 0.29s; }
.reveal:nth-child(5) { animation-delay: 0.37s; }
.reveal:nth-child(6) { animation-delay: 0.45s; }

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

/* view exit */
.view.leaving .reveal {
  animation: sink 0.28s var(--ease) forwards;
}
@keyframes sink {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .view.leaving .reveal { animation-duration: 0.01s !important; }
}

/* ---------- masthead / home ---------- */

.masthead h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  width: fit-content; /* shrink-wrap: morph boxes must match the crumb name exactly */
}

.role {
  color: var(--ink-dim);
  margin-top: 0.15rem;
}

.bio {
  margin-top: 1.5rem;
  color: var(--ink-dim);
  max-width: 52ch;
}
.bio + .bio { margin-top: 1rem; }
.bio a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--ink-faint), var(--ink-faint));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-image 0.3s;
}
.bio a:hover {
  background-image: linear-gradient(var(--accent), var(--accent));
}

/* ---------- home index nav ---------- */

.index {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
}

.index-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  align-items: baseline;
  gap: 1rem;
  padding: 1.05rem 0;
  border-top: 1px solid var(--hairline);
  text-decoration: none;
  transition: padding-left 0.35s var(--ease);
}
.index-row:last-child { border-bottom: 1px solid var(--hairline); }

.index-title { font-weight: 500; width: fit-content; }

.index-note {
  color: var(--ink-faint);
  font-size: 0.85rem;
  transition: color 0.3s;
}

.index-row:hover { padding-left: 0.6rem; }
.index-row:hover .index-note { color: var(--ink-dim); }

/* ---------- footer ---------- */

.foot {
  margin-top: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.foot-social { display: flex; gap: 1.25rem; }
.foot-social a {
  text-decoration: none;
  color: var(--ink-faint);
  transition: color 0.3s;
}
.foot-social a:hover { color: var(--ink); }

.foot-meta { font-variant-numeric: tabular-nums; }

/* ---------- subpage chrome ---------- */

.crumb {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

/* the crumb name and nav labels match the masthead h1 / index-title
   typography exactly, so their view transitions are pure translation —
   any size difference would read as a zoom with ghosting */
.back {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  transition: opacity 0.3s;
}
.back:hover { opacity: 0.7; }

.topnav {
  display: flex;
  gap: 1.4rem;
}
.topnav a {
  display: inline-block;
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.3s;
}
.topnav a:hover { color: var(--ink); }
.topnav a.on { color: var(--ink); }

.view-sub {
  color: var(--ink-dim);
  margin-top: 2.5rem;
  text-wrap: balance; /* if it must wrap, break into even lines, never an orphan word */
}
.view-sub a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-faint);
  transition: border-color 0.3s;
}
.view-sub a:hover { border-color: var(--accent); }

/* ---------- lists (writing, contact) ---------- */

.list {
  margin-top: 2.75rem;
  display: flex;
  flex-direction: column;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title year" "sub year";
  column-gap: 1.25rem;
  padding: 0.95rem 0;
  border-top: 1px solid var(--hairline);
  text-decoration: none;
  transition: padding-left 0.35s var(--ease);
}
.row:last-child { border-bottom: 1px solid var(--hairline); }

.row-title {
  grid-area: title;
  font-weight: 500;
  color: var(--ink-dim);
  transition: color 0.3s;
}

.row-sub {
  grid-area: sub;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-faint);
  transition: color 0.3s;
}
.row-sub:empty { display: none; }

.row-year {
  grid-area: year;
  align-self: start;
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.row:hover { padding-left: 0.6rem; }
.row:hover .row-title { color: var(--ink); }
.row:hover .row-sub { color: var(--ink-dim); }
.row:hover .row-year { color: var(--accent); }

.aside {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.list-label {
  margin-top: 3.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.list-label + .list { margin-top: 1rem; }
.aside a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: color 0.3s, border-color 0.3s;
}
.aside a:hover { color: var(--ink); border-color: var(--accent); }

/* ---------- resume ---------- */

.work-grid {
  margin-top: 3.25rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 4.5rem;
  align-items: start;
}

/* ---------- skills rail ---------- */

.skills-rail {
  position: sticky;
  top: clamp(2rem, 10vh, 6rem);
}

.skills-rail h3 {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}

.skills-rail ul { list-style: none; }

.skills-rail li {
  font-size: 0.88rem;
  color: var(--ink-faint);
  padding: 0.28rem 0;
  cursor: default;
  transition: color 0.45s var(--ease), transform 0.45s var(--ease);
}

.skills-rail li.lit {
  color: var(--ink);
  transform: translateX(3px);
}

/* ---------- resume column ---------- */

.resume { min-width: 0; }

.cv-item {
  padding: 1.35rem 0;
  border-top: 1px solid var(--hairline);
  opacity: 0.4;
  transition: opacity 0.5s var(--ease);
}
.cv-item.active { opacity: 1; }

.cv-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.cv-role { font-weight: 500; }

.cv-dates {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cv-org {
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin-top: 0.1rem;
}

.cv-points {
  margin-top: 0.7rem;
  list-style: none;
}
.cv-points li {
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.cv-edu {
  padding: 1.35rem 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.cv-edu h3 {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.cv-edu p {
  margin-top: 0.6rem;
  color: var(--ink-dim);
  font-size: 0.9rem;
}

/* ---------- print (Download PDF → print dialog) ---------- */

@media print {
  :root { --bg: #fff; --ink: #111; --ink-dim: #333; --ink-faint: #666; --hairline: #ddd; --accent: #111; }
  body::before { display: none; }
  #app { padding: 0; max-width: none; }
  .topnav, .skills-rail, .view[hidden] { display: none !important; }
  body::after { display: none; }
  .reveal { opacity: 1 !important; transform: none !important; animation: none !important; }
  .work-grid { display: block; margin-top: 1.5rem; }
  .cv-item { opacity: 1 !important; }
  a { text-decoration: none; }
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .work-grid {
    display: block;
  }
  /* rail becomes a sticky top bar of tags */
  .skills-rail {
    top: 0;
    z-index: 2;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 1rem;
  }
  .skills-rail h3 { display: none; }
  .skills-rail ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
  }
  .skills-rail li { padding: 0; font-size: 0.78rem; }
  .skills-rail li::before { display: none; }
  .skills-rail li.lit { transform: none; }
}

@media (max-width: 480px) {
  .index-row { grid-template-columns: 5rem 1fr; }
  .index-note { display: none; }
}
