/* ==========================================================================
   navry.dev — single stylesheet, no build step, no external requests.
   Order: tokens → base → layout → components → motion → responsive → print
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Warm charcoal rather than black: softer on the eyes, less "default dark". */
  --bg:          #0b0c0e;
  --bg-raised:   #111317;
  --line:        #23262b;
  --line-strong: #31353b;

  --text:        #e9e6e0;
  --text-dim:    #a3a7ac;
  --text-faint:  #7d828a;  /* lightest tone still clearing WCAG AA on --bg-raised */

  --accent:      #e0a03c;  /* amber — links, markers, the live cells */
  --accent-dim:  #a9762a;
  --sage:        #86a894;  /* secondary, used sparingly for mono labels */

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text",
               "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono",
               "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;

  --step--1: clamp(0.8125rem, 0.79rem + 0.11vw, 0.875rem);
  --step-0:  clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --step-1:  clamp(1.125rem, 1.06rem + 0.3vw, 1.3125rem);
  --step-2:  clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --step-3:  clamp(2.25rem, 1.6rem + 3.1vw, 4rem);

  --shell:    64rem;
  --measure:  38rem;
  --gutter:   clamp(1.25rem, 5vw, 2.5rem);
  --aside:    13rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.7;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: from-font;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-variant-ligatures: none;
}

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

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% -150%;
  z-index: 10;
  padding: 0.6rem 1.1rem;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 0 0 6px 6px;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-decoration: none;
  transition: translate 180ms var(--ease);
}

.skip-link:focus-visible { translate: -50% 0; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.shell {
  width: min(100%, var(--shell));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 220ms var(--ease);
}

.topbar.is-stuck { border-bottom-color: var(--line); }

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: 6px;
  object-fit: cover;
  transition: filter 180ms var(--ease);
}

.brand:hover .brand__mark { filter: brightness(1.15); }

.brand__tld { color: var(--text-faint); font-weight: 500; }

.topnav {
  display: flex;
  gap: clamp(0.9rem, 3vw, 1.9rem);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-dim);
}

.topnav a {
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}

.topnav a:hover { color: var(--text); }

.topnav a[aria-current="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { padding-block: clamp(3.5rem, 11vh, 7rem) clamp(3rem, 9vh, 5.5rem); }

.hero__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(2rem, 6vw, 4rem);
}

.hero__text { max-width: var(--measure); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.eyebrow__dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 14%, transparent);
}

.hero__name {
  margin-top: 1.1rem;
  font-size: var(--step-3);
  letter-spacing: -0.035em;
}

.hero__role {
  margin-top: 0.9rem;
  font-size: var(--step-1);
  color: var(--text-dim);
  font-weight: 450;
}

.hero__tagline {
  margin-top: 1.9rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--accent-dim);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.9;
  color: var(--text-dim);
}

.hero__tagline-em { color: var(--accent); }

.portrait {
  flex: none;
  width: clamp(9.5rem, 19vw, 14.5rem);
  margin: 0;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  /* Calmed down a shade so it sits with the page instead of shouting over it. */
  filter: saturate(0.92) brightness(0.96);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  display: grid;
  grid-template-columns: var(--aside) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(3rem, 8vh, 5rem);
  border-top: 1px solid var(--line);
}

.section__aside { position: relative; }

.section__label {
  position: sticky;
  top: 6rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--sage);
  text-transform: lowercase;
}

.section__num { color: var(--text-faint); }
.section__num::after { content: " /"; color: var(--line-strong); }

.section__body { min-width: 0; }
.section__intro { margin-bottom: 2.25rem; }

.prose { max-width: var(--measure); color: var(--text-dim); }
.prose p + p { margin-top: 1.15rem; }
.prose em { color: var(--text); font-style: italic; }

/* --------------------------------------------------------------------------
   Projects
   -------------------------------------------------------------------------- */

.projects {
  display: grid;
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.project {
  position: relative;
  background: var(--bg);
  padding: 1.6rem clamp(0.75rem, 2vw, 1.4rem);
  transition: background 220ms var(--ease);
}

.project::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
  scale: 1 0;
  transform-origin: top;
  transition: scale 260ms var(--ease);
}

.project:hover { background: var(--bg-raised); }
.project:hover::before { scale: 1 1; }

.project__title {
  font-size: var(--step-1);
  letter-spacing: -0.015em;
}

.project__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin-top: 0.7rem;
}

.project__meta code {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-faint);
  background: var(--bg-raised);
  white-space: nowrap;
}

.project__desc {
  max-width: var(--measure);
  margin-top: 0.9rem;
  color: var(--text-dim);
}

.project__links { margin-top: 0.9rem; }

.arrow-link {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent);
  text-decoration: none;
}

.arrow-link::after {
  content: " →";
  display: inline-block;
  transition: translate 180ms var(--ease);
}

.arrow-link:hover::after { translate: 3px 0; }

/* --------------------------------------------------------------------------
   Interests
   -------------------------------------------------------------------------- */

.interests {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: clamp(1.75rem, 4vw, 2.5rem);
}

.interest__icon {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: var(--sage);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.interest__title {
  margin-top: 0.7rem;
  font-size: var(--step-0);
  letter-spacing: 0;
}

.interest__desc {
  margin-top: 0.5rem;
  font-size: var(--step--1);
  line-height: 1.75;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem 3.5rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

.footer__brand { color: var(--text-dim); }
.footer__note { color: var(--text-faint); font-style: italic; }

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.15rem;
  color: var(--text-dim);
}

.footer__links a {
  padding-block: 0.25rem;
  text-decoration-color: var(--line-strong);
  transition: color 180ms var(--ease), text-decoration-color 180ms var(--ease);
}

.footer__links a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent-dim);
}

/* --------------------------------------------------------------------------
   Motion
   Scroll-driven, so the page needs no JavaScript to become readable. Browsers
   without `animation-timeline` simply render the final state.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal-in linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 24%;
    }
  }
}

@keyframes reveal-in {
  from { opacity: 0; translate: 0 0.9rem; }
  to   { opacity: 1; translate: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 54rem) {
  .section {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .section__label { position: static; }

  /* Photo above the name once there is no room beside it. */
  .hero__inner {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 2.25rem;
  }

  .portrait { width: min(14rem, 60%); }
}

@media (max-width: 34rem) {
  .topbar__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding-block: 0.75rem;
  }

  /* Roomier tap targets where there is no pointer. */
  .topnav {
    gap: 1rem;
    margin-bottom: 0.2rem;
  }

  .topnav a { padding-block: 0.5rem; }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  :root { --bg: #fff; --text: #111; --text-dim: #333; --text-faint: #555; --line: #ccc; }
  body { background: #fff; color: #111; }
  .topbar, .portrait, .skip-link { display: none; }
  .section { break-inside: avoid; }
}
