/* ==========================================================================
   Page order (one 1080px column):
     header -> hero (name + affirmation sigil) -> the name (eternal flower)
     -> what i do -> what i like (pearls) -> links -> contact -> footer

   Contents
     1.  Design tokens
     2.  Base
     3.  Background (handwriting, grain)
     4.  Page + header
     5.  Hero
     6.  Hero sigil
     7.  The name (flower + eternal)
     8.  Sections, titles, dividers
     9.  What i do
     10. What i like (pearls)
     11. Links
     12. Contact
     13. Buttons
     14. Footer
     15. Reduced motion
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* colors */
  --void: #06060a;                          /* page background */
  --void-2: #13121c;                        /* soft light in the top-right corner */
  --ink: #ecebf3;                           /* main text */
  --ash: #9a98aa;                           /* secondary text */
  --dim: #615f70;                           /* quiet text */
  --line: rgba(236, 235, 243, 0.12);        /* hairlines */
  --line-strong: rgba(236, 235, 243, 0.28);
  --haze: rgba(236, 235, 243, 0.055);       /* hover background */
  --glow: rgba(214, 219, 255, 0.45);        /* chrome glow */
  --wound: #6b1a29;                         /* dark red, text selection */

  /* pearl / chrome gradient */
  --pearl-hi: #ffffff;
  --pearl-1: #d9d8e5;
  --pearl-2: #8a889b;
  --pearl-3: #24232d;

  /* fonts */
  --f-display: "Grenze Gotisch", "UnifrakturMaguntia", "Old English Text MT", Georgia, serif;
  --f-body: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --f-mono: "Fragment Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --f-script: "Mrs Saint Delafield", "Snell Roundhand", "Apple Chancery", cursive;

  color-scheme: dark;
}


/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  margin: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--void);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--wound);
  color: var(--ink);
}

:focus-visible {
  outline: 1px dashed var(--ink);
  outline-offset: 4px;
}

a {
  color: inherit;
}

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

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


/* --------------------------------------------------------------------------
   3. Background (handwriting, grain)
   -------------------------------------------------------------------------- */

.handwriting {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(110% 80% at 82% -12%, var(--void-2) 0%, transparent 62%);
}

.handwriting p {
  position: absolute;
  inset: -25% -15%;
  margin: 0;
  font-family: var(--f-script);
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  line-height: 1.3;
  color: var(--ink);
  opacity: 0.06;
  transform: rotate(-7deg);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 25% 35%, #000 0%, transparent 78%);
          mask-image: radial-gradient(ellipse 70% 60% at 25% 35%, #000 0%, transparent 78%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.045;
  background-size: 180px 180px;
}


/* --------------------------------------------------------------------------
   4. Page + header
   -------------------------------------------------------------------------- */

.page {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px;
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
}

.logo canvas {
  display: block;
  width: 24px;
  height: 36px;
}

.nav {
  display: flex;
  gap: 24px;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}

.nav a {
  color: var(--ash);
  text-decoration: none;
  transition: color 0.25s;
}

.nav a:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .nav {
    display: none;
  }
}


/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas: "text sigil";
  align-items: center;
  gap: clamp(16px, 4vw, 56px);
  padding-block: clamp(28px, 5vw, 56px) clamp(40px, 6vw, 72px);
}

.hero-text {
  grid-area: text;
  min-width: 0;
  container-type: inline-size; /* lets the name scale with its column (cqi units) */
}

.hero-name {
  margin: 0 0 0.2em;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(3.2rem, 22cqi, 8.6rem);
  line-height: 0.92;
  letter-spacing: -0.005em;
  /* chrome text */
  background: linear-gradient(176deg,
    var(--pearl-hi) 0%, var(--pearl-1) 30%, var(--pearl-hi) 46%,
    var(--pearl-2) 64%, var(--pearl-1) 82%, var(--pearl-hi) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px var(--glow));
}

.hero-roles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0 0 26px;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.hero-roles i {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--dim);
}

.hero-intro {
  max-width: 36ch;
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.42rem);
  line-height: 1.45;
  color: var(--ash);
}

.hero-intro a {
  color: var(--ink);
  text-decoration-color: var(--dim);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s;
}

.hero-intro a:hover {
  text-decoration-color: var(--ink);
}

@media (max-width: 780px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "sigil" "text";
    gap: 28px;
  }
}


/* --------------------------------------------------------------------------
   6. Hero sigil
   -------------------------------------------------------------------------- */

.sigil-figure {
  grid-area: sigil;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: clamp(520px, 58vw, 660px);
  margin: 0;
}

.sigil-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.sigil-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.sigil-glow {
  animation: breathe 6.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

.sigil-caption {
  margin: 0;
  padding-top: 10px;
  text-align: center;
  font-style: italic;
  font-size: clamp(1.3rem, 2.3vw, 1.6rem);
  line-height: 1.25;
  color: var(--ink);
  text-wrap: balance;
}

@media (max-width: 780px) {
  .sigil-figure {
    height: 480px;
  }
}


/* --------------------------------------------------------------------------
   7. The name (flower + eternal)
   An eternal flower turning inside a ring of text that turns the other way.
   -------------------------------------------------------------------------- */

.name-section {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
  padding-block: clamp(24px, 4vw, 48px) clamp(48px, 7vw, 88px);
}

.bloom {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1;
}

.bloom-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: spin 150s linear infinite reverse;
}

.ring-line {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 0.6;
}

.ring-line--faint {
  stroke: var(--line);
}

.bloom-ring text {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  fill: var(--ash);
}

.bloom canvas {
  position: absolute;
  inset: 15%;
  display: block;
  width: 70%;
  height: 70%;
  animation: spin 240s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.name-text {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--ash);
}

.name-title {
  margin: 0 0 18px;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.8rem, 6.4vw, 4.6rem);
  line-height: 0.98;
  text-wrap: balance;
  background: linear-gradient(176deg,
    var(--pearl-hi) 0%, var(--pearl-1) 34%, var(--pearl-hi) 50%,
    var(--pearl-2) 72%, var(--pearl-hi) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px var(--glow));
}

.name-title .plus {
  padding-inline: 0.15em;
  font-family: var(--f-mono);
  font-size: 0.5em;
  vertical-align: 0.35em;
}

.name-gloss {
  max-width: 30ch;
  margin: 0;
  font-style: italic;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.35;
  color: var(--ash);
}

@media (max-width: 720px) {
  .name-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .bloom {
    max-width: 300px;
    justify-self: center;
  }
}


/* --------------------------------------------------------------------------
   8. Sections, titles, dividers
   -------------------------------------------------------------------------- */

.section {
  padding-block: clamp(36px, 6vw, 72px);
  scroll-margin-top: 24px;
}

.section-title {
  position: relative;
  margin: 0 0 clamp(24px, 4vw, 40px);
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

/* Arrival: when a section is reached from a link (js/ui/navigation.js adds .arrive),
   the title flares and a glowing thread draws under it. */
.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -12px;
  width: min(280px, 70%);
  height: 1px;
  background: linear-gradient(90deg, var(--ink), transparent);
  box-shadow: 0 0 8px var(--glow);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0;
  pointer-events: none;
}

.section-title.arrive {
  animation: flare 1.6s ease-out;
}

.section-title.arrive::after {
  animation: thread 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes flare {
  0%   { text-shadow: none; }
  25%  { text-shadow: 0 0 18px var(--glow), 0 0 42px var(--glow); }
  100% { text-shadow: none; }
}

@keyframes thread {
  0%   { transform: scaleX(0); opacity: 1; }
  55%  { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* Horizontal thorn ornaments between sections (drawn by js/sigils/ornament.js) */
.divider {
  display: block;
  width: min(100%, 760px);
  height: 64px;
  margin-inline: auto;
}


/* --------------------------------------------------------------------------
   9. What i do
   -------------------------------------------------------------------------- */

.role-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.role {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  column-gap: 18px;
  row-gap: 4px;
  padding: 6px clamp(16px, 2.6vw, 30px);
  border-left: 1px solid var(--line);
}

.role:first-child {
  padding-left: 0;
  border-left: 0;
}

.role canvas {
  grid-row: 1 / span 2;
  display: block;
  width: 52px;
  height: 92px;
}

.role h3 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.05;
}

.role p {
  margin: 4px 0 0;
  font-size: 1.08rem;
  line-height: 1.42;
  color: var(--ash);
}

.role p a {
  color: var(--ink);
  text-decoration-color: var(--dim);
  text-underline-offset: 3px;
}

@media (max-width: 820px) {
  .role-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .role {
    padding: 20px 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .role:first-child {
    padding-top: 0;
    border-top: 0;
  }
}


/* --------------------------------------------------------------------------
   10. What i like (pearls hanging on threads)
   -------------------------------------------------------------------------- */

/* the thorn bar the pearls hang from; its centre line sits on the rail */
.pearl-bar {
  position: relative;
  z-index: 0;
  margin-bottom: -32px;
}

.pearl-list {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)); /* change 7 when adding/removing pearls */
  gap: 0 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* the rail */
.pearl-list::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 4%, var(--line-strong) 96%, transparent);
}

.pearl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform-origin: 50% 0;
  animation: sway var(--duration, 7s) ease-in-out var(--delay, 0s) infinite alternate;
}

@keyframes sway {
  from { transform: rotate(-1.5deg); }
  to   { transform: rotate(1.5deg); }
}

.thread {
  width: 1px;
  height: var(--thread, 60px);
  background: var(--ash);
}

.thread--short {
  height: 12px;
}

.knot {
  width: 7px;
  height: 7px;
  margin-top: -1px;
  border: 1px solid var(--ink);
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--glow);
}

.pearl {
  width: var(--size, 62px);
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%,
    var(--pearl-hi) 0 5%, var(--pearl-1) 16%, var(--pearl-2) 47%,
    var(--pearl-3) 77%, var(--void) 100%);
  box-shadow:
    0 0 22px var(--glow),
    inset 0 -8px 14px rgba(0, 0, 0, 0.55);
  transition: transform 0.45s ease, box-shadow 0.45s ease;
}

.pearl-item:hover .pearl {
  transform: scale(1.07);
  box-shadow:
    0 0 36px var(--glow),
    0 0 70px var(--glow),
    inset 0 -8px 14px rgba(0, 0, 0, 0.55);
}

.pearl-label {
  margin-top: 14px;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

@media (max-width: 640px) {
  .pearl-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 30px 8px;
  }

  .pearl-label {
    font-size: 0.62rem;
    letter-spacing: 0;
  }

  /* second row has no rail above it, so its threads fade in */
  .pearl-item:nth-child(n + 5) .thread:first-child {
    background: linear-gradient(to bottom, transparent, var(--ash) 45%);
  }
}


/* --------------------------------------------------------------------------
   11. Links
   -------------------------------------------------------------------------- */

.link-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.link-list a {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 18px;
  padding: 18px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.3s ease;
}

.link-list a:hover,
.link-list a:focus-visible {
  background: linear-gradient(90deg, var(--haze), transparent 75%);
}

.link-thorn {
  display: block;
  width: 40px;
  height: 12px;
  fill: var(--ash);
  transform-origin: left center;
  transition: transform 0.35s ease, fill 0.35s ease, filter 0.35s ease;
}

.link-list a:hover .link-thorn {
  transform: scaleX(1.14);
  fill: var(--ink);
  filter: drop-shadow(0 0 4px var(--glow));
}

.link-text {
  min-width: 0;
}

.link-title {
  display: block;
  font-family: var(--f-display);
  font-size: 1.6rem;
  line-height: 1.1;
}

.link-desc {
  display: block;
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--ash);
}

.link-url {
  max-width: 36ch;
  overflow: hidden;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--dim);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.link-arrow {
  font-family: var(--f-mono);
  color: var(--ash);
  transition: transform 0.3s ease, color 0.3s ease;
}

.link-list a:hover .link-arrow {
  transform: translate(3px, -3px);
  color: var(--ink);
}

@media (max-width: 640px) {
  .link-list a {
    grid-template-columns: 30px minmax(0, 1fr) 16px;
    gap: 12px;
    padding-inline: 0;
  }

  .link-thorn {
    width: 30px;
  }

  .link-url {
    display: none;
  }
}


/* --------------------------------------------------------------------------
   12. Contact (inside a pointed arch)
   -------------------------------------------------------------------------- */

.contact-window {
  position: relative;
  max-width: 560px;
  margin-inline: auto;
  padding: clamp(70px, 11vw, 104px) clamp(20px, 5vw, 52px) clamp(28px, 5vw, 44px);
  text-align: center;
}

.arch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent);
          mask-image: linear-gradient(to bottom, #000 62%, transparent);
}

.arch path {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke; /* keeps the line 1px while the arch stretches */
}

.arch .arch-inner {
  stroke: var(--line);
}

.contact-row {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-block: 20px;
}

.contact-row + .contact-row {
  border-top: 1px solid var(--line);
}

.contact-label {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--ash);
}

.contact-value {
  font-family: var(--f-body);
  font-style: italic;
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
          user-select: all;
}

a.contact-value:hover {
  text-shadow: 0 0 18px var(--glow);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}


/* --------------------------------------------------------------------------
   13. Buttons
   -------------------------------------------------------------------------- */

.button {
  padding: 0.5em 0.9em;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ash);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.button:hover {
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 0 14px var(--glow);
}

.button.is-done {
  color: var(--ink);
  border-color: var(--ink);
}


/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  padding-block: 24px 48px;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 20px;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.footer-row a {
  color: var(--ash);
  text-decoration: none;
}

.footer-row a:hover {
  color: var(--ink);
}


/* --------------------------------------------------------------------------
   15. Reduced motion
   -------------------------------------------------------------------------- */

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

  .pearl-item,
  .sigil-glow,
  .bloom-ring,
  .bloom canvas,
  .section-title.arrive::after {
    animation: none;
  }

  .sigil-glow {
    opacity: 0.8;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
