/* ==========================================================================
   typhoon-dark — a dark, royal-purple theme inspired by Grav's Typhoon
   ========================================================================== */

:root {
  /* Surfaces (near-black with a violet cast) */
  --bg:          #0e0b16;
  --bg-elev:     #141021;
  --surface:     #1b1530;
  --surface-2:   #241c3d;
  --border:      #322a4d;

  /* Text */
  --text:        #ece9f5;
  --text-dim:    #b7aed0;
  --text-faint:  #877ea6;

  /* Royal purple accent scale */
  --primary:      #7c3aed;   /* royal purple — the main color */
  --primary-400:  #a78bfa;
  --primary-300:  #c4b5fd;
  --primary-600:  #6d28d9;
  --glow:         rgba(124, 58, 237, 0.45);
  --grad:         linear-gradient(135deg, #7c3aed 0%, #a855f7 55%, #c084fc 100%);

  /* Layout */
  --wrap:        72rem;
  --wrap-narrow: 46rem;
  --radius:      14px;
  --radius-sm:   9px;

  --font-body:    'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: 'Sora', var(--font-body);
  --font-mono:    ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* subtle radial purple ambience behind everything */
  background-image:
    radial-gradient(60rem 60rem at 80% -10%, rgba(124, 58, 237, 0.16), transparent 60%),
    radial-gradient(50rem 50rem at -10% 10%, rgba(168, 85, 247, 0.10), transparent 55%);
  background-attachment: fixed;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--primary-300); text-decoration: none; transition: color .15s ease; }
a:hover { color: #fff; }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; font-weight: 700; }

code, pre { font-family: var(--font-mono); font-size: .9em; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--primary); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0; z-index: 200;
}
.skip-link:focus { left: 0; }

/* --- Header / nav --------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(14, 11, 22, 0.72);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 0; flex-wrap: wrap;
}
.brand {
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  color: var(--text); letter-spacing: -0.01em;
}
.brand:hover { color: var(--primary-300); }
.nav { display: flex; gap: .35rem; flex-wrap: wrap; }
.nav__link {
  color: var(--text-dim); font-weight: 500; font-size: .95rem;
  padding: .4rem .7rem; border-radius: 999px; transition: color .15s ease, background .15s ease;
}
.nav__link:hover { color: #fff; background: var(--surface); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  padding: .7rem 1.2rem; border-radius: 999px; cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn--primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 24px -8px var(--glow);
}
.btn--primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 30px -10px var(--glow); }
.btn--ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover { color: #fff; border-color: var(--primary); background: var(--surface); }

/* --- Hero (Typhoon-style full-bleed cover) -------------------------------- */
.hero {
  position: relative;
  display: flex; align-items: center;
  min-height: 62vh;
  padding: 5rem 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  --cover: none;
}
.hero--article { min-height: 52vh; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: var(--cover);
  background-size: cover; background-position: center;
  filter: saturate(1.05);
}
.hero__overlay {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(80rem 50rem at 70% 0%, rgba(124, 58, 237, 0.30), transparent 55%),
    linear-gradient(180deg, rgba(14,11,22,0.55) 0%, rgba(14,11,22,0.82) 100%);
}
.hero__inner { position: relative; z-index: 2; }
.hero__title {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 800; letter-spacing: -0.03em; margin: 0;
  background: linear-gradient(180deg, #fff 30%, var(--primary-300));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__title--article { max-width: 20ch; }
.hero__subtitle {
  font-size: clamp(1.05rem, 2.5vw, 1.4rem);
  color: var(--text-dim); margin: 1rem 0 0; font-weight: 400;
}

/* Simple page hero (home, blog index, pages) */
.page-hero {
  padding: 4.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(50rem 20rem at 50% -50%, rgba(124,58,237,0.22), transparent 70%);
}
.page-hero__title {
  font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0; letter-spacing: -0.02em;
}
.page-hero__title--gradient {
  background: linear-gradient(180deg, #fff 30%, var(--primary-300));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-hero__subtitle { color: var(--text-dim); margin: .8rem 0 0; font-size: 1.1rem; }

/* --- Main layout ---------------------------------------------------------- */
.main { padding: 3.5rem 0 4rem; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin: 0 0 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: .8rem;
}
.section-head__title { font-size: 1.5rem; margin: 0; }
.section-head__link { font-family: var(--font-display); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.home-section { margin-top: 3.5rem; }
.intro.prose { max-width: var(--wrap-narrow); }

/* --- Post list / cards ---------------------------------------------------- */
.post-list { display: grid; gap: 1.1rem; }
.post-list--full { gap: 1.25rem; }

.post-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem 1.7rem;
  transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 16px 40px -20px var(--glow);
}
.post-card__meta {
  display: flex; align-items: center; gap: .5rem;
  color: var(--text-faint); font-size: .82rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 500;
}
.post-card__meta--light { color: var(--primary-300); }
.post-card__cat { color: var(--primary-400); }
.dot { opacity: .5; }
.post-card__title { font-size: 1.45rem; margin: .5rem 0 .5rem; letter-spacing: -0.01em; }
.post-card__title a { color: var(--text); }
.post-card__title a:hover { color: var(--primary-300); }
.post-card__summary { color: var(--text-dim); margin: 0 0 .9rem; }
.readmore { font-family: var(--font-display); font-weight: 600; font-size: .92rem; }

/* --- Photography teaser (home) -------------------------------------------- */
.photo-teaser {
  display: flex; align-items: flex-end;
  min-height: 14rem; border-radius: var(--radius);
  padding: 1.6rem; color: #fff;
  background: var(--grad);
  position: relative; overflow: hidden;
  box-shadow: 0 20px 50px -24px var(--glow);
}
.photo-teaser::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(30rem 20rem at 90% 120%, rgba(0,0,0,.35), transparent 60%);
}
.photo-teaser__text { position: relative; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }
.photo-teaser:hover { color: #fff; }

/* --- Prose (article & page content) --------------------------------------- */
.prose { max-width: var(--wrap-narrow); font-size: 1.06rem; }
.article-body, .prose--page { margin-inline: auto; }
.prose > * + * { margin-top: 1.25rem; }
.prose h2 { font-size: 1.7rem; margin-top: 2.4rem; letter-spacing: -0.01em; }
.prose h3 { font-size: 1.32rem; margin-top: 1.8rem; }
.prose h2, .prose h3 { scroll-margin-top: 5rem; }
.prose a { color: var(--primary-300); text-decoration: underline; text-decoration-color: rgba(167,139,250,.4); text-underline-offset: 3px; }
.prose a:hover { color: #fff; text-decoration-color: var(--primary); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .35rem; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose blockquote {
  margin: 1.6rem 0; padding: .4rem 1.2rem;
  border-left: 3px solid var(--primary);
  background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-dim); font-style: italic;
}
.prose code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .12em .4em; border-radius: 6px; color: var(--primary-300);
}
.prose pre {
  background: #0a0812; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.1rem 1.3rem; overflow-x: auto;
}
.prose pre code { background: none; border: none; padding: 0; color: var(--text); }

/* Syntax highlighting — Pygments token colors, tuned to the royal-purple dark
   palette. Keywords lean violet; strings green and numbers fuchsia give enough
   hue contrast to stay readable against the purple. */
.highlight .hll { background: rgba(124, 58, 237, 0.16); display: block; }
.highlight .c, .highlight .ch, .highlight .cm, .highlight .c1, .highlight .cs { color: #6f6690; font-style: italic; }  /* comments */
.highlight .cp { color: #a78bfa; }                                                            /* preprocessor */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr { color: #c4b5fd; font-weight: 600; }   /* keywords: SELECT/FROM/WHERE */
.highlight .kc, .highlight .kt, .highlight .no { color: #f0abfc; }                             /* constants / types: NULL, INT */
.highlight .o { color: #d6bcfa; }                                                             /* operators: = < > */
.highlight .ow { color: #c4b5fd; font-weight: 600; }                                          /* word operators: AND/OR/IN */
.highlight .p { color: #b7aed0; }                                                             /* punctuation */
.highlight .s, .highlight .sa, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd,
.highlight .s2, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr,
.highlight .s1, .highlight .ss { color: #7ee787; }                                            /* strings */
.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo,
.highlight .il { color: #f0abfc; }                                                            /* numbers */
.highlight .nf, .highlight .fm { color: #93c5fd; }                                            /* function names: COUNT(), SUM() */
.highlight .nb, .highlight .bp { color: #a78bfa; }                                            /* builtins */
.highlight .nc, .highlight .nn, .highlight .ne { color: #f0abfc; }                            /* classes / namespaces */
.highlight .na { color: #93c5fd; }                                                            /* attributes */
.highlight .nt { color: #a78bfa; }                                                            /* tags */
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: #e8b4ff; }            /* variables: @var */
.highlight .nd { color: #a78bfa; }                                                            /* decorators */
.highlight .err { color: inherit; }                                                           /* don't red-box dialect tokens */
.highlight .gd { color: #ffb4b4; background: rgba(255, 100, 100, 0.10); }                     /* diff removed */
.highlight .gi { color: #7ee787; background: rgba(120, 231, 135, 0.10); }                     /* diff added */
.highlight .gh, .highlight .gu { color: #a78bfa; font-weight: 600; }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: 600; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border); padding: .5rem .8rem; text-align: left; }
.prose th { background: var(--surface); }

/* --- Tags / post nav ------------------------------------------------------ */
.tags { max-width: var(--wrap-narrow); margin: 2rem auto 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  font-size: .82rem; color: var(--primary-300);
  background: var(--surface); border: 1px solid var(--border);
  padding: .25rem .7rem; border-radius: 999px;
}
.post-nav { max-width: var(--wrap-narrow); margin: 2.5rem auto 0; }

/* --- Pagination ----------------------------------------------------------- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-top: 2.5rem;
}
.pagination__count { color: var(--text-faint); font-size: .9rem; }

/* --- Archives ------------------------------------------------------------- */
.archive-list { list-style: none; padding: 0; margin: 0; max-width: var(--wrap-narrow); }
.archive-list__item {
  display: flex; gap: 1rem; align-items: baseline;
  padding: .8rem 0; border-bottom: 1px solid var(--border);
}
.archive-list__item time { color: var(--text-faint); font-size: .85rem; min-width: 9rem; flex-shrink: 0; }

/* --- Photography gallery -------------------------------------------------- */
.gallery-intro { margin-bottom: 2.5rem; }
.gallery { columns: 3 16rem; column-gap: 1rem; }
.gallery__item { break-inside: avoid; margin: 0 0 1rem; }
.gallery__link {
  display: block; position: relative; border-radius: var(--radius-sm);
  overflow: hidden; border: 1px solid var(--border);
}
.gallery__link img { width: 100%; transition: transform .4s ease; }
.gallery__link:hover img { transform: scale(1.05); }
.gallery__caption {
  position: absolute; inset: auto 0 0 0; z-index: 1;
  padding: 2.2rem .9rem .75rem; color: #fff; font-size: .9rem; font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  background: linear-gradient(180deg, transparent, rgba(8,6,14,.9));
  opacity: 0; transform: translateY(.5rem);
  transition: opacity .25s ease, transform .25s ease;
}
.gallery__link:hover .gallery__caption,
.gallery__link:focus-visible .gallery__caption { opacity: 1; transform: translateY(0); }

/* CSS-only lightbox via :target */
.lightbox {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 2rem;
  background: rgba(8, 6, 14, 0.92);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}
.lightbox:target { opacity: 1; visibility: visible; pointer-events: auto; }
.lightbox__backdrop { position: absolute; inset: 0; cursor: zoom-out; }
.lightbox__content { position: relative; margin: 0; max-width: min(100%, 64rem); }
.lightbox__content img {
  max-height: 82vh; width: auto; margin-inline: auto; border-radius: var(--radius-sm);
  border: 1px solid var(--border); box-shadow: 0 30px 80px -20px #000;
}
.lightbox__content figcaption { text-align: center; color: var(--text-dim); margin-top: .8rem; font-size: .95rem; }
.lightbox__close {
  position: absolute; top: 1.2rem; right: 1.4rem; z-index: 2;
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center;
  font-size: 1.6rem; line-height: 1; color: #fff;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.lightbox__close:hover { background: var(--primary); color: #fff; }

/* --- Mermaid diagrams ----------------------------------------------------- */
.mermaid {
  margin: 1.8rem 0;
  text-align: center;
  /* Hide the raw diagram source until Mermaid replaces it with an <svg>. */
  line-height: normal;
}
.mermaid:not([data-processed]) { visibility: hidden; }
.mermaid svg { max-width: 100%; height: auto; display: block; margin-inline: auto; }

/* --- Misc ----------------------------------------------------------------- */
.empty { color: var(--text-faint); }

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 2.5rem 0;
}
.footer-wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  color: var(--text-faint); font-size: .9rem;
}
.footer-wrap p { margin: 0; }
.footer__social { display: flex; gap: 1rem; }
.footer__social a { color: var(--text-dim); }
.footer__social a:hover { color: var(--primary-300); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero, .hero--article { min-height: 56vh; padding: 4rem 0; }
  .gallery { columns: 1; }
  .archive-list__item { flex-direction: column; gap: .1rem; }
  .archive-list__item time { min-width: 0; }
  .site-header { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
