/* Layout: a nocturne single theme by choice. 1120px frame, editorial ~65ch text column,
   arched "chapel window" cards for featured work, ledger rows for résumé + projects. */
:root {
  --night: #231942;      /* page ground */
  --crypt: #170f2d;      /* deepest surface: footer, inputs */
  --vault: #2b2050;      /* raised surface */
  --dusk: #5E548E;       /* rules, fills */
  --wisteria: #9F86C0;   /* secondary text accent */
  --orchid: #BE95C4;     /* primary accent */
  --rose: #E0B1CB;       /* highlights, eyebrows, candlelight */
  --parchment: #F6EEF5;  /* body text */
  --mist: #CDBFDC;       /* secondary text */
  --line: rgba(159, 134, 192, 0.26);
  --line-strong: rgba(190, 149, 196, 0.55);
  --glow: rgba(224, 177, 203, 0.22);

  --display: "Playfair Display", "Didot", "Bodoni 72", Georgia, serif;
  --body: "Lato", "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.45rem, 2.6vw, 1.75rem);
  --step-3: clamp(1.9rem, 4vw, 2.6rem);
  --step-4: clamp(2.7rem, 7.5vw, 5rem);

  --frame: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 60% 45% at 85% -5%, rgba(190, 149, 196, 0.16), transparent 70%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(94, 84, 142, 0.35), transparent 70%),
    var(--night);
  background-attachment: fixed;
  color: var(--parchment);
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

#motes { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.site-header, main, .site-footer { position: relative; z-index: 1; }
main { flex: 1 0 auto; }
.site-header, .site-footer { flex-shrink: 0; }

::selection { background: var(--orchid); color: var(--crypt); }

a { color: var(--rose); text-decoration-color: var(--line-strong); text-underline-offset: 0.2em; transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--parchment); text-decoration-color: var(--rose); }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; border-radius: 3px; }

.wrap { max-width: var(--frame); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--display); color: var(--parchment); margin: 0; text-wrap: balance; }
h1 { font-size: var(--step-4); font-weight: 900; line-height: 1.02; letter-spacing: -0.015em; }
h1 em { font-weight: 400; font-style: italic; color: var(--orchid); }
h2 { font-size: var(--step-3); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; }
h2 em { font-style: italic; font-weight: 400; color: var(--orchid); }
h3 { font-size: var(--step-2); font-weight: 600; line-height: 1.2; }
h4 { font-size: var(--step-1); font-weight: 600; font-style: italic; color: var(--rose); }
p { margin: 0; max-width: 65ch; }
.lead { font-size: var(--step-1); font-weight: 300; line-height: 1.6; color: var(--mist); }
.eyebrow {
  font-family: var(--body); font-weight: 700; font-size: 0.75rem;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--rose);
  display: inline-flex; align-items: center; gap: 0.75em;
}
.eyebrow::before { content: ""; width: 2.25rem; height: 1px; background: var(--rose); opacity: .7; }
.muted { color: var(--mist); }
.small { font-size: var(--step--1); }
.tabular { font-variant-numeric: tabular-nums; }

/* Purple-pen squiggle underline */
.pen {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='8' viewBox='0 0 40 8'%3E%3Cpath d='M0 5 Q5 1 10 5 T20 5 T30 5 T40 5' fill='none' stroke='%23BE95C4' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x; background-position: 0 100%; background-size: 20px 6px;
  padding-bottom: 0.18em;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px);
  background: rgba(23, 15, 45, 0.78);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding-block: 0.9rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--parchment); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand span { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 1.2rem; letter-spacing: 0.01em; }
.brand:hover { color: var(--rose); }
.nav { display: flex; gap: 0.25rem 1.6rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav a {
  font-family: var(--body); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--mist); text-decoration: none; padding-block: 0.35rem; display: inline-block; position: relative;
}
.nav a:hover { color: var(--parchment); }
.nav a[aria-current="page"] { color: var(--rose); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0.2em; bottom: -2px; height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='8' viewBox='0 0 40 8'%3E%3Cpath d='M0 5 Q5 1 10 5 T20 5 T30 5 T40 5' fill='none' stroke='%23E0B1CB' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 20px 6px; background-repeat: repeat-x;
}

/* ---------- Buttons & links ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn {
  display: inline-flex; align-items: center; gap: 0.6em;
  font-family: var(--body); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 0.95em 1.6em; border-radius: 2px; text-decoration: none; cursor: pointer;
  border: 1px solid var(--orchid); transition: background .25s, color .25s, box-shadow .25s, transform .25s;
}
.btn-primary { background: var(--orchid); color: var(--crypt); }
.btn-primary:hover { background: var(--rose); border-color: var(--rose); color: var(--crypt); box-shadow: 0 0 28px var(--glow); }
.btn-ghost { background: transparent; color: var(--parchment); }
.btn-ghost:hover { background: rgba(190, 149, 196, 0.12); color: var(--parchment); box-shadow: 0 0 28px var(--glow); }
.btn svg { width: 1.1em; height: 1.1em; }

.text-link {
  font-weight: 700; font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase;
  text-decoration: none; color: var(--rose); display: inline-flex; align-items: center; gap: 0.45em;
}
.text-link::after { content: "→"; letter-spacing: 0; transition: transform .2s; }
.text-link:hover::after { transform: translateX(3px); }
.text-link.ext::after { content: "↗"; }

.socials { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; padding: 0; margin: 0; }
.socials a {
  display: inline-flex; align-items: center; gap: 0.5em; text-decoration: none;
  font-size: 0.85rem; font-weight: 700; color: var(--mist);
  padding: 0.45em 0.9em; border: 1px solid var(--line); border-radius: 999px;
}
.socials a:hover { color: var(--parchment); border-color: var(--orchid); }
.socials svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- Sections ---------- */
section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section-head { display: grid; gap: 0.9rem; margin-bottom: clamp(2rem, 4vw, 3rem); }

.flourish { display: flex; justify-content: center; color: var(--dusk); padding-block: 0.5rem; }
.flourish svg { width: min(360px, 80%); height: 24px; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 7vw, 6rem) clamp(2rem, 5vw, 4rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero-copy { display: grid; gap: 1.6rem; min-width: 0; }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: 100%; max-width: 400px; height: auto; overflow: visible; }

.page-hero { padding-block: clamp(3rem, 7vw, 5rem) clamp(1.5rem, 3vw, 2.5rem); }
.page-hero .wrap { display: grid; gap: 1.2rem; }

/* Hero load sequence */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
  .rise.d1 { animation-delay: .08s; } .rise.d2 { animation-delay: .18s; }
  .rise.d3 { animation-delay: .3s; }  .rise.d4 { animation-delay: .42s; }
  @keyframes rise { from { opacity: .001; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  .moon-glow { animation: breathe 7s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  @keyframes breathe { 50% { opacity: .65; transform: scale(1.04); } }
}
.eyes-open { opacity: 0; transition: opacity .25s; }
.eyes-shut { transition: opacity .25s; }
.hero-art:hover .eyes-open { opacity: 1; }
.hero-art:hover .eyes-shut { opacity: 0; }
.flame { transform-box: fill-box; transform-origin: 50% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .flame { animation: flicker 2.4s ease-in-out infinite; }
  @keyframes flicker { 25% { transform: scale(.94, 1.06) skewX(2deg); } 50% { transform: scale(1.03, .95); } 75% { transform: scale(.97, 1.04) skewX(-2deg); } }
  .candle-glow { animation: glowpulse 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  @keyframes glowpulse { 50% { opacity: .7; transform: scale(1.06); } }
}

/* ---------- About / through-line ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.split > * { min-width: 0; }
.prose { display: grid; gap: 1.2rem; }
.prose p { color: var(--mist); }
.prose strong { color: var(--parchment); font-weight: 700; }

.pullquote {
  margin: 0.5rem 0 0; padding: 1.6rem 0 0; border-top: 1px solid var(--line);
  font-family: var(--display); font-style: italic; font-size: var(--step-2); line-height: 1.4; color: var(--parchment);
}
.pullquote cite { display: block; margin-top: .9rem; font-family: var(--body); font-style: normal; font-weight: 700; font-size: 0.72rem; letter-spacing: .22em; text-transform: uppercase; color: var(--wisteria); }

/* ---------- Focus areas ---------- */
.focus { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.focus article { padding: 2rem clamp(1rem, 2.5vw, 2rem) 2rem 0; display: grid; gap: 0.9rem; align-content: start; }
.focus article + article { padding-left: clamp(1rem, 2.5vw, 2rem); border-left: 1px solid var(--line); }
.focus p { color: var(--mist); font-size: 1rem; }
.glyph { color: var(--orchid); width: 34px; height: 34px; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0; }
.tags li {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--wisteria); border: 1px solid var(--line); padding: 0.3em 0.75em; border-radius: 999px; white-space: nowrap;
}

/* ---------- Arched window cards ---------- */
.windows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 1.75rem); }
.window { display: flex; flex-direction: column; transition: transform .35s ease, filter .35s ease; }
.window .arch { display: block; width: 100%; height: auto; overflow: visible; margin-bottom: -0.5px; }
.arch-fill { fill: rgba(94, 84, 142, 0.3); }
.arch-outer { fill: none; stroke: var(--line-strong); stroke-width: 1; transition: stroke .35s; }
.arch-inner { fill: none; stroke: var(--line); stroke-width: 1; }
.arch-rose { stroke: var(--rose); }
.window-body {
  flex: 1; display: flex; flex-direction: column; position: relative;
  padding-bottom: 1.9rem;
  border: 1px solid var(--line-strong); border-top: 0; border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, rgba(94, 84, 142, 0.3), rgba(23, 15, 45, 0.55) 70%);
  transition: border-color .35s;
}
.window-body::before { /* inner tracery line, continues the arch's inner line */
  content: ""; position: absolute; top: 0; left: 2.5%; right: 2.5%; bottom: 8px;
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 3px 3px; pointer-events: none;
}
.window-content {
  flex: 1; position: relative; margin-top: -24%;
  display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center;
  padding-inline: clamp(1.4rem, 3vw, 2.1rem);
}
.window:hover { transform: translateY(-4px); filter: drop-shadow(0 0 22px var(--glow)); }
.window:hover .arch-outer { stroke: var(--rose); }
.window:hover .window-body { border-color: var(--rose); }
.window .kind { font-size: 0.7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--wisteria); }
.window p { color: var(--mist); font-size: 0.98rem; }
.window .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.25rem; margin-top: auto; padding-top: 0.4rem; }

/* ---------- Ledger (currently / résumé) ---------- */
.ledger { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.ledger > li { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: 0.4rem 2rem; padding-block: 1.25rem; border-bottom: 1px solid var(--line); }
.ledger .label { font-weight: 700; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--rose); padding-top: 0.3em; }
.ledger .value { color: var(--mist); min-width: 0; }
.ledger .value strong { color: var(--parchment); }

/* ---------- CTA band ---------- */
.cta-band { text-align: center; }
.cta-band .wrap { display: grid; justify-items: center; gap: 1.4rem; }
.cta-band p { color: var(--mist); }
.moon-sm { width: 60px; height: 60px; color: var(--rose); filter: drop-shadow(0 0 18px var(--glow)); }

/* ---------- Résumé ---------- */
.resume-grid { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 2rem clamp(2rem, 5vw, 4rem); }
.resume-grid > * { min-width: 0; }
.resume-toc { position: sticky; top: 6rem; align-self: start; display: grid; gap: 0.25rem; }
.resume-toc a { font-weight: 700; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mist); text-decoration: none; padding-block: 0.4rem; border-left: 1px solid var(--line); padding-left: 1rem; }
.resume-toc a:hover { color: var(--rose); border-left-color: var(--rose); }
.resume-block { scroll-margin-top: 6rem; display: grid; gap: 1.8rem; padding-bottom: 3.5rem; }
.resume-block > h2 { padding-bottom: 0.9rem; border-bottom: 1px solid var(--line-strong); }

.job { display: grid; gap: 0.7rem; padding-bottom: 1.8rem; border-bottom: 1px solid var(--line); }
.job:last-child { border-bottom: 0; padding-bottom: 0; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1.5rem; }
.job-head h3 { font-size: var(--step-1); font-weight: 700; }
.job-head h3 .tag { font-family: var(--body); font-size: 0.7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--wisteria); margin-left: .5rem; vertical-align: middle; }
.job .org { font-family: var(--display); font-style: italic; color: var(--orchid); font-size: 1.05rem; }
.dates { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rose); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bullets { margin: 0.2rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.55rem; color: var(--mist); max-width: 72ch; }
.bullets li::marker { content: "✦  "; color: var(--dusk); font-size: 0.7em; }
.bullets li { padding-left: 0.3rem; }

.skills { display: grid; gap: 1.4rem; }
.skill-row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 0.6rem 1.5rem; align-items: baseline; }
.skill-row h4 { font-size: 1.05rem; }

.edu { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.edu li { display: grid; gap: 0.1rem; }
.edu .degree { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--parchment); }
.edu .school { color: var(--mist); font-size: 0.95rem; }

/* ---------- Projects ---------- */
.proj-group { display: grid; gap: 0; margin-bottom: clamp(3rem, 6vw, 4.5rem); }
.proj-group > header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line-strong); }
.proj-group > header p { color: var(--mist); font-size: .95rem; }
.proj { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 1.2rem clamp(1.5rem, 4vw, 3.5rem); padding-block: 2.2rem; border-bottom: 1px solid var(--line); }
.proj > * { min-width: 0; }
.proj-title { display: grid; gap: 0.6rem; align-content: start; }
.proj-title h3 { font-size: var(--step-2); }
.proj-title h3 small { display: block; font-family: var(--display); font-style: italic; font-weight: 400; font-size: 1.05rem; color: var(--orchid); margin-top: .3rem; }
.proj-title .kind { font-size: 0.7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--wisteria); }
.proj-body { display: grid; gap: 1rem; align-content: start; }
.proj-body .links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.proj.haunted { position: relative; }
.proj.haunted .proj-title::after {
  content: "Built for Halloween"; justify-self: start; margin-top: .2rem;
  font-family: var(--display); font-style: italic; font-size: .95rem; color: var(--rose);
}
.stat { font-family: var(--display); font-weight: 700; color: var(--rose); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.contact-grid > * { min-width: 0; }
.contact-aside { display: grid; gap: 1.6rem; }

.form {
  display: grid; gap: 1.25rem; padding: clamp(1.4rem, 3vw, 2.4rem);
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: linear-gradient(180deg, rgba(94, 84, 142, 0.22), rgba(23, 15, 45, 0.6));
  position: relative;
}
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.field { display: grid; gap: 0.45rem; min-width: 0; }
.field label { font-weight: 700; font-size: 0.72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--rose); }
.field input, .field select, .field textarea {
  width: 100%; font: 400 1rem/1.5 var(--body); color: var(--parchment);
  background: var(--crypt); border: 1px solid var(--line); border-radius: 3px; padding: 0.8rem 0.9rem;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--wisteria); opacity: .75; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--orchid); box-shadow: 0 0 0 3px rgba(190, 149, 196, .2); }
.field-extra { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.field-label { font-weight: 700; font-size: 0.72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--rose); }
.recaptcha { min-height: 78px; max-width: 100%; overflow: hidden; }
.recaptcha:empty { display: none; }
.captcha-note { display: flex; gap: .7rem; align-items: flex-start; font-size: .88rem; color: var(--mist); }
.captcha-note svg { flex: none; width: 20px; height: 20px; color: var(--orchid); margin-top: .15rem; }
.form-status { font-size: .95rem; padding: .9rem 1rem; border-radius: 3px; border: 1px solid var(--line-strong); background: rgba(190, 149, 196, .1); color: var(--parchment); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 0; border-top: 1px solid var(--line); background: rgba(23, 15, 45, 0.7); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem; padding-block: 2rem; }
.site-footer p { font-size: .85rem; color: var(--mist); }
.site-footer em { font-family: var(--display); color: var(--rose); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .windows { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-inline: auto; }
  .focus { grid-template-columns: minmax(0, 1fr); }
  .focus article, .focus article + article { padding: 1.6rem 0; border-left: 0; }
  .focus article + article { border-top: 1px solid var(--line); }
  .resume-grid { grid-template-columns: minmax(0, 1fr); }
  .resume-toc { position: static; display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
  .resume-toc a { border-left: 0; padding-left: 0; }
}
@media (max-width: 760px) {
  .hero .wrap, .split, .contact-grid, .proj { grid-template-columns: minmax(0, 1fr); }
  .hero-art { order: -1; }
  .hero-art svg { max-width: 240px; }
  .ledger > li, .skill-row { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .site-header .wrap { justify-content: center; }
  .nav { justify-content: center; gap: 0.25rem 1.1rem; }
}
