/* ==========================================================================
   intentsecurity.ai — Dark editorial, Cybersyn-inspired
   Palette: warm charcoal surfaces, amber accent, teal secondary
   Fonts: Source Serif 4 (display) + Satoshi (body)
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces */
  --color-bg:           #151413;
  --color-surface:      #1c1b19;
  --color-border:       #2e2d2a;

  /* Text */
  --color-text:         #c8c5be;
  --color-text-muted:   #8a8780;
  --color-text-faint:   #5c5a55;

  /* Accents — pulled from the Cybersyn photo */
  --color-amber:        #c4834a;
  --color-amber-dim:    #9a6838;
  --color-teal:         #5a9ea6;
  --color-teal-dim:     #3d7a82;

  /* Typography */
  --font-display: 'Source Serif 4', 'Georgia', serif;
  --font-body:    'Satoshi', 'Helvetica Neue', sans-serif;

  /* Fluid type */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1.05rem,  1rem    + 0.25vw, 1.175rem);
  --text-lg:   clamp(1.175rem, 1.05rem + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.25rem);
  --text-hero: clamp(2.5rem,   1rem    + 5vw,    4.5rem);

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Misc */
  --content-narrow: 680px;
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

::selection {
  background: rgba(196, 131, 74, 0.3);
  color: var(--color-text);
}

a {
  color: var(--color-teal);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--color-amber);
}

button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }

h1, h2, h3 { text-wrap: balance; line-height: 1.2; }
p, li, figcaption { text-wrap: pretty; max-width: 72ch; }

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


/* --- Site Header --- */
.site-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: var(--space-6) var(--space-8);
}

.wordmark {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}


/* --- Hero --- */
.hero {
  position: relative;
  width: 100%;
  /* Constrain height so the image doesn't overwhelm */
  max-height: 72vh;
  overflow: hidden;
}

.hero-image-wrap {
  position: relative;
  width: 100%;
}

.hero-image {
  width: 100%;
  height: auto;
  display: block;
  /* Slight warmth to unify with the palette */
  filter: saturate(0.8) brightness(0.85);
}

.hero-image-overlay {
  position: absolute;
  inset: 0;
  /* Top gradient for wordmark legibility + bottom fade into bg */
  background:
    linear-gradient(
      to bottom,
      rgba(21, 20, 19, 0.55) 0%,
      transparent 12%
    ),
    linear-gradient(
      to bottom,
      transparent 40%,
      rgba(21, 20, 19, 0.4) 70%,
      rgba(21, 20, 19, 1) 100%
    );
}


/* --- Essay --- */
.essay {
  max-width: var(--content-narrow);
  margin: 0 auto;
  padding: 0 var(--space-6);
  padding-bottom: var(--space-16);
}

.essay-header {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-12);
}

.essay-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 700;
  color: #e8e4dc;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.subtitle {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 300;
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.byline {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}


/* --- Essay Body --- */
.essay-body p {
  margin-bottom: var(--space-6);
}

.essay-body p:last-child {
  margin-bottom: 0;
}

.essay-body em {
  font-style: italic;
}

.essay-body strong {
  font-weight: 600;
  color: #d4d0c8;
}

.essay-body code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.88em;
  background: var(--color-surface);
  color: var(--color-amber);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

/* Emphasis line — "Intent, in other words, is infrastructure." */
.emphasis-line {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: #e8e4dc;
  margin-top: var(--space-10);
  margin-bottom: var(--space-10);
}


/* --- Pull Quotes --- */
.pull-quote {
  margin: var(--space-12) 0;
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.pull-quote p {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  font-style: italic;
  color: var(--color-amber);
  line-height: 1.4;
  max-width: none;
}

.pull-quote--final p {
  font-style: normal;
  font-weight: 600;
}


/* --- Footnote References --- */
.fn-ref {
  color: var(--color-amber);
  text-decoration: none;
  transition: color var(--transition);
}

.fn-ref:hover {
  color: var(--color-teal);
}

.fn-ref sup {
  font-size: 0.7em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  top: -0.5em;
}


/* --- Footnotes Section --- */
.essay-notes {
  margin-top: var(--space-16);
  padding-top: var(--space-10);
  border-top: 1px solid var(--color-border);
  padding-bottom: var(--space-20);
}

.notes-list {
  list-style: none;
  counter-reset: fn-counter;
}

.notes-list li {
  counter-increment: fn-counter;
  position: relative;
  padding-left: var(--space-8);
  margin-bottom: var(--space-6);
}

.notes-list li::before {
  content: counter(fn-counter) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-amber-dim);
  font-variant-numeric: tabular-nums;
}

.notes-list p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.notes-list a {
  color: var(--color-teal-dim);
}

.notes-list a:hover {
  color: var(--color-teal);
}

.fn-back {
  display: inline-block;
  margin-left: var(--space-2);
  font-size: 0.85em;
  color: var(--color-text-faint);
  text-decoration: none;
}

.fn-back:hover {
  color: var(--color-amber);
}


/* --- Smooth footnote scroll highlight --- */
.notes-list li:target {
  background: rgba(196, 131, 74, 0.08);
  border-radius: 4px;
  margin-left: calc(-1 * var(--space-3));
  padding-left: calc(var(--space-8) + var(--space-3));
  margin-right: calc(-1 * var(--space-3));
  padding-right: var(--space-3);
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}


/* --- Site Footer --- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-10) var(--space-6);
}

.footer-inner {
  max-width: var(--content-narrow);
  margin: 0 auto;
  text-align: center;
}

.footer-author {
  margin-bottom: var(--space-3);
}

.footer-author a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer-author a:hover {
  color: var(--color-amber);
}

.footer-links {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer-links a {
  color: var(--color-text-faint);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--color-teal);
}

.dot {
  margin: 0 var(--space-2);
  color: var(--color-border);
}


/* --- Responsive --- */
@media (max-width: 680px) {
  .site-header {
    padding: var(--space-4) var(--space-4);
  }

  .essay {
    padding: 0 var(--space-4);
  }

  .essay-header {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
    margin-bottom: var(--space-8);
  }

  .pull-quote {
    margin: var(--space-8) 0;
    padding: var(--space-6) 0;
  }

  .essay-notes {
    margin-top: var(--space-12);
    padding-top: var(--space-8);
  }
}

@media (max-width: 480px) {
  .essay-header h1 {
    font-size: clamp(1.75rem, 1rem + 4vw, 2.5rem);
  }

  .emphasis-line {
    font-size: var(--text-lg);
  }

  .pull-quote p {
    font-size: var(--text-lg);
  }
}





/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
