/* ============================================================
   XENOCORTICAL.COM — site stylesheet
   Personality: "the beauty of grown intelligence" — a scientific
   editorial journal with wet-lab color. Fraunces display serif,
   Space Grotesk body, deep ink + paper + fiber-map magenta.
   ============================================================ */

:root {
  --ink: #0b1026;
  --ink-2: #141b3d;
  --paper: #f7f4ed;
  --paper-2: #efe9dc;
  --magenta: #ff3d7f;
  --magenta-dark: #d61e5e;
  --cyan: #4fd8eb;
  --text: #1c2135;
  --text-muted: #5c6378;
  --line: #d8d2c4;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; border: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: clip;
}

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

a { color: inherit; }

::selection { background: var(--magenta); color: #fff; }

/* ---------- header ---------- */

.x-header {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.x-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.x-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-style: italic;
  font-size: 1.5rem;
  text-decoration: none;
  color: #fff;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  flex-shrink: 1;
}

.x-brand__tld {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--magenta);
  letter-spacing: 0.08em;
  margin-left: 2px;
}

.x-nav { display: flex; align-items: center; gap: 30px; flex-shrink: 0; }

.x-nav a {
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  transition: color 0.2s ease;
  padding: 6px 0;
}

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

.x-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 80;
  flex-shrink: 0;
}

.x-nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 0 auto;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.x-nav-toggle.open .x-nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.x-nav-toggle.open .x-nav-toggle__bar:nth-child(2) { opacity: 0; }
.x-nav-toggle.open .x-nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .x-nav-toggle { display: flex; }
  .x-nav {
    display: none;
    position: absolute;
    top: 66px;
    left: 0;
    right: 0;
    background: var(--ink);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 12px 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 70;
  }
  .x-nav.open { display: flex; }
  .x-nav a { padding: 12px 0; width: 100%; font-size: 1rem; letter-spacing: 0.1em; }
}

/* ---------- shared layout ---------- */

.x-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.x-kicker {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 18px;
}

.x-h1, .x-h2 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.x-h1 { font-size: clamp(2.6rem, 6.5vw, 5.2rem); }
.x-h2 { font-size: clamp(2rem, 4vw, 3.2rem); margin-bottom: 22px; }

.x-h1 em, .x-h2 em {
  font-style: italic;
  color: var(--magenta);
  font-weight: 400;
}

.x-lede {
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.x-btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 16px 30px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.x-btn--solid { background: var(--magenta); color: #fff; }
.x-btn--solid:hover { background: var(--magenta-dark); }
.x-btn--ghost { border: 1px solid rgba(255, 255, 255, 0.6); color: #fff; }
.x-btn--ghost:hover { border-color: var(--magenta); color: var(--magenta); }
.x-btn--ink { background: var(--ink); color: #fff; }
.x-btn--ink:hover { background: var(--magenta); }

/* ---------- hero ---------- */

.x-hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  background: var(--ink);
}

.x-hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(11, 16, 38, 0.62) 0%, rgba(11, 16, 38, 0.5) 55%, rgba(11, 16, 38, 0.85) 100%);
  pointer-events: none;
}

.x-hero__content {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 120px 20px 90px;
  width: 100%;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.x-hero__content .x-kicker { color: var(--cyan); }

.x-hero__content .x-h1 { color: #fff; margin-bottom: 26px; max-width: 15ch; }

.x-hero__content .x-lede {
  color: rgba(255, 255, 255, 0.86);
  margin: 0 0 38px 0;
  max-width: 560px;
  margin-left: 0;
}

.x-hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- stats strip ---------- */

.x-stats {
  background: var(--ink);
  color: var(--paper);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 56px 0;
}

.x-stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.x-stat__number {
  font-family: var(--serif);
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  font-weight: 500;
  color: var(--magenta);
  line-height: 1;
  margin-bottom: 10px;
}

.x-stat__label {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: rgba(247, 244, 237, 0.72);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .x-stats__grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- section rhythm ---------- */

.x-section { padding: 96px 0; }

.x-section--paper2 { background: var(--paper-2); }

.x-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 44px;
  flex-wrap: wrap;
}

.x-section__head p { max-width: 480px; color: var(--text-muted); }

/* ---------- post cards ---------- */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px 32px;
}

@media (max-width: 768px) {
  .blog-grid { grid-template-columns: 1fr; }
}

.x-card {
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.x-card:hover {
  box-shadow: 0 14px 40px rgba(11, 16, 38, 0.14);
  transform: translateY(-3px);
}

.x-card__media { display: block; overflow: hidden; }

.x-card__media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.x-card:hover .x-card__media img { transform: scale(1.03); }

.x-card__body { padding: 26px 28px 30px; display: flex; flex-direction: column; gap: 12px; flex: 1; }

.x-card__tags {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--magenta);
  font-weight: 500;
}

.x-card__title { font-family: var(--serif); font-size: 1.5rem; line-height: 1.2; font-weight: 500; }

.x-card__title a { text-decoration: none; color: var(--ink); transition: color 0.2s ease; }
.x-card__title a:hover { color: var(--magenta); }

.x-card__excerpt { color: var(--text-muted); font-size: 0.98rem; flex: 1; }

.x-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.x-card__dot { width: 4px; height: 4px; background: var(--magenta); border-radius: 50%; }

/* ---------- explainer Q&A ---------- */

.x-qa { max-width: 780px; margin: 0 auto; }

.x-qa__item { border-top: 1px solid var(--line); padding: 30px 0; }

.x-qa__item:last-child { border-bottom: 1px solid var(--line); }

.x-qa__q {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  color: var(--ink);
  margin-bottom: 12px;
}

.x-qa__a { color: var(--text-muted); }

/* ---------- definition pull-quote ---------- */

.x-pull {
  background: var(--ink);
  color: var(--paper);
  padding: 90px 0;
}

.x-pull blockquote {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  line-height: 1.3;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  font-style: italic;
}

.x-pull blockquote strong { color: var(--magenta); font-weight: 500; }

.x-pull cite {
  display: block;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(247, 244, 237, 0.6);
  margin-top: 28px;
  text-align: center;
}

/* ---------- about / portrait row ---------- */

.x-about__grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) 1fr;
  gap: 56px;
  align-items: center;
}

.x-about__photo img { width: 100%; box-shadow: 0 20px 50px rgba(11, 16, 38, 0.18); }

@media (max-width: 860px) {
  .x-about__grid { grid-template-columns: 1fr; }
  .x-about__photo { max-width: 380px; margin: 0 auto; }
}

.x-about p + p { margin-top: 16px; }
.x-about p { color: var(--text-muted); max-width: 60ch; }

/* ---------- contact ---------- */

.x-contact { background: var(--ink); color: var(--paper); }

.x-contact .x-kicker { color: var(--cyan); }

.x-contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 860px) {
  .x-contact__grid { grid-template-columns: 1fr; }
}

.x-contact__intro p { color: rgba(247, 244, 237, 0.75); margin-top: 16px; max-width: 44ch; }

.x-contact form { display: grid; gap: 16px; }

.x-contact input,
.x-contact textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 15px 16px;
  border-radius: 0;
  width: 100%;
}

.x-contact input::placeholder,
.x-contact textarea::placeholder { color: rgba(247, 244, 237, 0.55); }

.x-contact input:focus,
.x-contact textarea:focus { outline: 2px solid var(--magenta); outline-offset: 1px; }

.x-contact textarea { min-height: 140px; resize: vertical; }

.x-contact button[type="submit"] {
  justify-self: start;
  background: var(--magenta);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 16px 34px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.x-contact button[type="submit"]:hover { background: var(--magenta-dark); }
.x-contact button[type="submit"]:disabled { opacity: 0.6; cursor: wait; }

/* ---------- footer ---------- */

.x-footer {
  background: #070b1c;
  color: var(--paper);
  padding: 72px 0 0;
}

.x-footer__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 48px;
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr;
  gap: 48px;
}

@media (max-width: 860px) {
  .x-footer__inner { grid-template-columns: 1fr; gap: 36px; }
}

.x-footer__logo { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.4rem; margin-bottom: 14px; }

.x-footer__tag, .x-footer__note { color: rgba(247, 244, 237, 0.6); font-size: 0.92rem; line-height: 1.6; max-width: 36ch; }

.x-footer__head {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 16px;
}

.x-footer__col a {
  display: block;
  text-decoration: none;
  color: rgba(247, 244, 237, 0.78);
  font-size: 0.95rem;
  padding: 5px 0;
  transition: color 0.2s ease;
}

.x-footer__col a:hover { color: var(--magenta); }

.x-footer__legal {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 22px 20px;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: rgba(247, 244, 237, 0.55);
}

/* ---------- article pages (blog template) ---------- */

.x-article {
  background: var(--paper);
  padding: 72px 0 96px;
}

.x-article__head { max-width: 820px; margin: 0 auto 40px; padding: 0 20px; }

.x-article__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 24px;
}

.x-article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.x-article__meta .x-card__tags { letter-spacing: 0.18em; }

.x-article__hero { max-width: 980px; margin: 0 auto 48px; padding: 0 20px; }

.x-article__hero img { width: 100%; box-shadow: 0 16px 44px rgba(11, 16, 38, 0.16); }

.x-article__credit {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
  letter-spacing: 0.04em;
}

.x-article__body { max-width: 720px; margin: 0 auto; padding: 0 20px; }

.x-article__body > p,
.x-article__body li {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.13rem;
  line-height: 1.75;
  color: #242a40;
  margin-bottom: 1.35em;
}

.x-article__body h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  color: var(--ink);
  margin: 2.4em 0 0.7em;
  line-height: 1.2;
}

.x-article__body a { color: var(--magenta-dark); text-decoration: underline; text-underline-offset: 3px; }

.x-article__body ul, .x-article__body ol { padding-left: 1.4em; margin-bottom: 1.35em; }

.x-article__body li { margin-bottom: 0.5em; }

.x-article__body blockquote {
  border-left: 3px solid var(--magenta);
  padding: 6px 0 6px 24px;
  margin: 2em 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink);
}

.x-article__body figure { margin: 2.2em 0; }

.x-article__body figure img { width: 100%; }

.x-article__body figcaption {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* citations */

.x-refs {
  margin-top: 3.5em;
  border-top: 2px solid var(--ink);
  padding-top: 28px;
}

.x-refs h2 { font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink); margin-bottom: 20px; }

.x-refs ol { padding-left: 1.3em; }

.x-refs li {
  font-family: var(--sans) !important;
  font-size: 0.9rem !important;
  line-height: 1.6 !important;
  color: var(--text-muted) !important;
  margin-bottom: 0.7em !important;
}

/* TOC + related */

[data-blog-toc] { max-width: 720px; margin: 0 auto 44px; padding: 0 20px; }

[data-blog-toc] .x-toc {
  background: #fff;
  border: 1px solid var(--line);
  padding: 24px 28px;
}

[data-blog-toc] p, [data-blog-toc] div:first-child { font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--magenta); margin-bottom: 12px; }

[data-blog-toc] a {
  display: block;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 5px 0;
}

[data-blog-toc] a:hover { color: var(--magenta); }

.x-related { background: var(--paper-2); padding: 80px 0; }

.x-related .x-wrap { max-width: 1180px; }

[data-blog-related] { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }

@media (max-width: 980px) { [data-blog-related] { grid-template-columns: 1fr; } }

/* breadcrumb */

.x-crumbs { max-width: 820px; margin: 0 auto 8px; padding: 0 20px; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }

.x-crumbs a { color: var(--text-muted); text-decoration: none; }
.x-crumbs a:hover { color: var(--magenta); }
