/* ==========================================================================
   ragnr — Modern technology. Timeless craftsmanship.

   Design notes
   - Palette: drawn from antique, gold-tooled green leather bindings. Gold is
     the single accent and is used sparingly (60 / 30 / 10: green / ivory / gold).
   - Type: Cormorant Garamond (a Garamond revival, rooted in 16th-century
     punchcutting) for display; Manrope (a geometric-humanist sans that echoes
     the wordmark's rounded construction) for UI and body.
   - Scale: perfect fourth (1.333) for running text, wider steps for display.
   - Measure: body copy is held to ~62ch for comfortable reading.
   - Motion: one orchestrated entrance, slow ease-out curves, nothing loops.
     Everything is disabled under prefers-reduced-motion.
   ========================================================================== */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette */
  --green-950: #031F18;
  --green-900: #052E24; /* page ground */
  --green-850: #063B2E; /* Midnight green — hero ground */
  --green-800: #07543F; /* Deep emerald */
  --green-700: #185643; /* Forest */
  --green-500: #397D65; /* Sage */
  --gold-300: #DCC48C;
  --gold-400: #C4A463;  /* Warm brass — accessible on all greens here */
  --gold-500: #B0914D;  /* Antique gold — decorative only */
  --ivory: #EFE6D0;
  --ivory-muted: #B8C2B0;

  --gold-line: rgb(196 164 99 / 0.28);
  --gold-line-strong: rgb(196 164 99 / 0.55);

  /* Type */
  --font-display: "Cormorant Garamond", "EB Garamond", Garamond, "Times New Roman", serif;
  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: 0.84rem;
  --step-0: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-1: clamp(1.33rem, 1.2rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
  --step-3: clamp(2.3rem, 1.8rem + 2vw, 3.4rem);

  /* Space (8pt rhythm) */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;
  --space-7: clamp(5rem, 4rem + 5vw, 9rem);

  --container: 72rem;
  --measure: 62ch;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);     /* long, soft settle */
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-4);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ivory);
  background-color: var(--green-900);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  overflow-x: hidden;
}

/* A whisper of grain, like the tooth of book cloth. Static: no repaint cost. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 .95  0 0 0 0 .8  0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Vignette — draws the eye to the centre, as light falls on an open book. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 90% at 50% 40%, transparent 55%, rgb(2 18 14 / 0.6) 100%);
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--gold-400);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.3s ease;
}
a:hover { color: var(--gold-300); }

:focus-visible {
  outline: 1px solid var(--gold-300);
  outline-offset: 4px;
  border-radius: 2px;
}

::selection { background: var(--gold-400); color: var(--green-900); }

h1, h2, h3 { margin: 0; font-weight: 500; }
p { margin: 0; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  z-index: 100;
  padding: var(--space-1) var(--space-2);
  background: var(--ivory);
  color: var(--green-900);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}
.skip-link:focus { transform: none; }

.container {
  width: min(100% - 2 * var(--space-3), var(--container));
  margin-inline: auto;
}
.container--narrow { width: min(100% - 2 * var(--space-3), 46rem); }

.br-sm { display: none; }
@media (max-width: 30rem) { .br-sm { display: inline; } }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
}
.site-header::after { /* gilt fillet: a single hairline that fades at its ends */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line-strong) 15%, var(--gold-line-strong) 85%, transparent);
  transform-origin: center;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: min(100% - 2 * var(--space-3), 90rem);
  margin-inline: auto;
  padding-block: var(--space-3);
}

.brand { display: block; color: var(--ivory); }
.brand__lockup { height: 1.75rem; width: auto; aspect-ratio: 906 / 189; }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(var(--space-2), 3vw, var(--space-4));
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  position: relative;
  color: var(--ivory);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.site-nav a:not(.site-nav__cta)::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.35em;
  height: 1px;
  background: var(--gold-400);
  transform: scaleX(0);
  transition: transform 0.45s var(--ease-out);
}
.site-nav a:not(.site-nav__cta):hover::after { transform: scaleX(1); }
.site-nav a:hover { color: var(--gold-300); }

.site-nav__cta {
  display: inline-block;
  padding: 0.4em 1.1em;
  border: 1px solid var(--gold-line-strong);
  border-radius: 999px;
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}
.site-nav__cta:hover { border-color: var(--gold-400); background: rgb(196 164 99 / 0.08); }

@media (max-width: 34rem) {
  .brand__lockup { height: 1.4rem; }
  .site-nav ul { gap: var(--space-2); }
  .site-nav a { font-size: 0.875rem; }
  .site-nav__cta { padding: 0.35em 0.9em; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--space-6) + var(--space-3)) var(--space-3) var(--space-6);
  overflow: hidden;
  isolation: isolate;
  /* Light falling on the cover: a soft glow that settles into the page ground. */
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgb(24 86 67 / 0.6), transparent 72%),
    linear-gradient(180deg, var(--green-850) 0%, var(--green-850) 55%, var(--green-900) 100%);
}

.hero__ring {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: min(118vh, 112vw, 68rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ring { width: 100%; height: 100%; overflow: visible; }
.ring__rule, .ring__plait path { fill: none; stroke: var(--gold-500); }
.ring__rule { stroke-width: 1.2; opacity: 0.24; }
.ring__plait path { stroke-width: 1.1; opacity: 0.16; }

.hero__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 48rem;
}

.hero__title { width: min(100%, 40rem); line-height: 0; }
.hero__lockup { width: 100%; height: auto; overflow: visible; }
.hero__wordmark { color: var(--ivory); overflow: visible; }

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: min(100%, 34rem);
  color: var(--gold-400);
}
.ornament__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line-strong));
}
.ornament__rule:last-child { background: linear-gradient(90deg, var(--gold-line-strong), transparent); }
.ornament__knot { width: 2.4rem; height: auto; aspect-ratio: 48 / 42; flex: none; }
.hero__ornament { margin-block: clamp(var(--space-4), 4vw, var(--space-5)) var(--space-3); }

.hero__tagline {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0.005em;
  color: var(--gold-400);
  text-wrap: balance;
}
.hero__lede {
  max-width: 36ch;
  margin-top: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ivory);
  opacity: 0.88;
  text-wrap: balance;
}
.hero__actions { margin-top: var(--space-5); }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.85em;
  padding: 0.9em 1.9em;
  border: 1px solid var(--gold-400);
  border-radius: 999px;
  color: var(--gold-300);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}
.button:hover {
  color: var(--green-900);
  background-color: var(--gold-400);
  box-shadow: 0 0 0 4px rgb(196 164 99 / 0.12);
}
.button__arrow { width: 1.15em; height: auto; transition: transform 0.4s var(--ease-out); }
.button:hover .button__arrow { transform: translateX(4px); }

.hero__cue {
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: min(70vw, 34rem);
  transform: translateX(-50%);
  color: var(--gold-500);
}
.hero__cue svg { width: 1.1rem; flex: none; transition: transform 0.4s var(--ease-out), color 0.3s ease; }
.hero__cue:hover svg { color: var(--gold-300); transform: translateY(3px); }
.hero__cue-rule { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
.hero__cue-rule:last-child { background: linear-gradient(90deg, var(--gold-line), transparent); }

@media (max-height: 40rem) and (min-width: 40rem) {
  .hero__cue { display: none; }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section { padding-block: var(--space-7); position: relative; }
.section + .section::before { /* fillet between sections */
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(100% - 2 * var(--space-3), var(--container));
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--gold-line) 20%, var(--gold-line) 80%, transparent);
}

.section__head { max-width: var(--measure); margin-bottom: var(--space-5); }

.eyebrow {
  display: flex;
  align-items: baseline;
  gap: 0.9em;
  margin-bottom: var(--space-2);
  color: var(--gold-400);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.eyebrow__numeral {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: none;
}
.eyebrow::after {
  content: "";
  flex: 0 0 3rem;
  height: 1px;
  align-self: center;
  background: var(--gold-line-strong);
}

.section__title {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.section__intro {
  margin-top: var(--space-3);
  color: var(--ivory-muted);
  text-wrap: pretty;
}

/* Work ------------------------------------------------------------------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-3);
}

.card {
  --corner: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: clamp(var(--space-3), 3vw, var(--space-5));
  border: 1px solid var(--gold-line);
  background:
    linear-gradient(160deg, rgb(255 255 255 / 0.035), transparent 60%),
    rgb(5 46 36 / 0.55);
  transition: border-color 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
/* Corner tooling — the small gilt brackets found on fine bindings. */
.card::before, .card::after {
  content: "";
  position: absolute;
  width: var(--corner);
  height: var(--corner);
  border: 1px solid var(--gold-400);
  opacity: 0.55;
  transition: width 0.5s var(--ease-out), height 0.5s var(--ease-out), opacity 0.5s var(--ease-out);
}
.card::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.card::after  { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }
.card:hover { border-color: var(--gold-line-strong); }
.card:hover::before, .card:hover::after { --corner: 22px; opacity: 1; }

.card--wide { grid-column: 1 / -1; }
.card--wide .card__body { max-width: var(--measure); }

.card__meta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.card__kind { color: var(--ivory-muted); font-size: var(--step--1); letter-spacing: 0.04em; }
.card__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.15;
  text-wrap: balance;
}
.card__body { color: var(--ivory-muted); }
.card__link { margin-top: auto; padding-top: var(--space-1); font-weight: 500; text-decoration: none; }
.card__link span { display: inline-block; transition: transform 0.4s var(--ease-out); }
.card__link:hover span { transform: translateX(4px); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.3em 0.85em;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  color: var(--ivory);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.06em;
}
.status::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: var(--gold-400);
}
.status--live::before { background: #6FCB9F; }
.status--beta::before { background: var(--gold-300); }
.status--dev::before  { background: var(--gold-500); }

/* About ------------------------------------------------------------------ */
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-5) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.principle { position: relative; padding-top: var(--space-3); border-top: 1px solid var(--gold-line); }
.principle__numeral {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 500;
}
.principle__title {
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.15;
}
.principle p { color: var(--ivory-muted); max-width: 34ch; }

/* Contact ---------------------------------------------------------------- */
.section--contact { text-align: center; }
.section--contact .eyebrow { justify-content: center; }
.section--contact .eyebrow::before {
  content: "";
  flex: 0 0 3rem;
  height: 1px;
  align-self: center;
  background: var(--gold-line-strong);
}
.section--contact .section__intro { margin-inline: auto; max-width: 40ch; }

.contact-link {
  display: inline-block;
  margin-top: var(--space-5);
  padding-bottom: 0.15em;
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.2rem + 3vw, 3rem);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  background: linear-gradient(var(--gold-400), var(--gold-400)) left bottom / 0 1px no-repeat;
  transition: background-size 0.6s var(--ease-out), color 0.3s ease;
  overflow-wrap: anywhere;
}
.contact-link:hover { color: var(--gold-300); background-size: 100% 1px; }

/* Footer ----------------------------------------------------------------- */
.site-footer { padding-block: var(--space-6) var(--space-5); }
.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}
.site-footer__knot { width: 1.75rem; height: auto; aspect-ratio: 48 / 42; color: var(--gold-500); }
.site-footer__motto { font-family: var(--font-display); font-style: italic; font-size: var(--step-1); color: var(--ivory); opacity: 0.85; }
.site-footer__legal { color: var(--ivory-muted); font-size: var(--step--1); letter-spacing: 0.04em; }

/* 404 -------------------------------------------------------------------- */
.lost { display: grid; place-items: center; min-height: 100vh; min-height: 100svh; padding: var(--space-6) var(--space-3); text-align: center; }
.lost .lost__code { font-family: var(--font-display); font-size: clamp(4rem, 3rem + 6vw, 7rem); line-height: 1; color: var(--gold-400); }
.lost .ornament { margin: var(--space-4) auto; }
.lost p { color: var(--ivory-muted); margin-bottom: var(--space-5); }

/* ==========================================================================
   Motion — the entrance

   0.2s  guilloché ring is engraved, slowly
   0.3s  the two pieces of the R slide together and lock
   0.7s  the wordmark is drawn, letter by letter
   1.4s  ornament rules extend; the triquetra is traced
   1.6s  a single pass of light across the gilt
   1.7s  tagline, lede and call to action rise into place
   2.1s  navigation and scroll cue arrive
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .ring__rule {
    stroke-dasharray: 1 1;
    stroke-dashoffset: 1;
    animation: engrave 3.2s var(--ease-inout) 0.2s forwards;
  }
  .ring__rule + .ring__rule { animation-delay: 0.45s; }
  .ring__plait { opacity: 0; animation: fade-in 2.4s ease-out 0.9s forwards; }

  .hero__mark-bowl, .hero__mark-leg {
    opacity: 0;
    animation: lock-in 1.3s var(--ease-out) 0.3s forwards;
  }
  .hero__mark-bowl { --from: translate(26px, -10px); }
  .hero__mark-leg  { --from: translate(-26px, 18px); animation-delay: 0.42s; }

  .hero__sheen { animation: sheen 1.5s var(--ease-inout) 1.55s both; }

  .hero__wordmark path {
    stroke-dasharray: 1 1;
    stroke-dashoffset: 1;
    animation: draw 1.15s var(--ease-inout) forwards;
  }
  .hero__wordmark path:nth-child(1) { animation-delay: 0.70s; }
  .hero__wordmark path:nth-child(2) { animation-delay: 0.80s; }
  .hero__wordmark path:nth-child(3) { animation-delay: 0.90s; }
  .hero__wordmark path:nth-child(4) { animation-delay: 1.00s; }
  .hero__wordmark path:nth-child(5) { animation-delay: 1.10s; }

  .hero__ornament .ornament__rule {
    transform: scaleX(0);
    animation: extend 1.1s var(--ease-out) 1.4s forwards;
  }
  .hero__ornament .ornament__rule:first-child { transform-origin: right; }
  .hero__ornament .ornament__rule:last-child  { transform-origin: left; }
  .hero__ornament .ornament__knot path {
    stroke-dasharray: 1 1;
    stroke-dashoffset: 1;
    animation: draw 1.4s var(--ease-inout) 1.3s forwards;
  }

  .hero__tagline, .hero__lede, .hero__actions {
    opacity: 0;
    animation: rise 1.1s var(--ease-out) forwards;
  }
  .hero__tagline { animation-delay: 1.65s; }
  .hero__lede    { animation-delay: 1.8s; }
  .hero__actions { animation-delay: 1.95s; }

  .site-header__inner { opacity: 0; animation: fade-in 1s ease-out 2.1s forwards; }
  .site-header::after { transform: scaleX(0); animation: extend 1.6s var(--ease-out) 1.9s forwards; }
  .hero__cue { opacity: 0; animation: fade-in 1.2s ease-out 2.4s forwards; }

  /* Scroll reveals (only when JS is present to remove them again). */
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
    transition-delay: var(--reveal-delay, 0s);
  }
  .js .reveal.is-visible { opacity: 1; transform: none; }
}

@keyframes fade-in { to { opacity: 1; } }
@keyframes engrave { to { stroke-dashoffset: 0; } }
@keyframes draw    { to { stroke-dashoffset: 0; } }
@keyframes extend  { to { transform: scaleX(1); } }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes lock-in {
  from { opacity: 0; transform: var(--from); }
  to   { opacity: 1; transform: none; }
}
@keyframes sheen {
  from { transform: translateX(0) skewX(-20deg); }
  to   { transform: translateX(480px) skewX(-20deg); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__sheen { display: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
