/* ============================================================
   Reluctant Founder — a manuscript that keeps editing itself
   ============================================================ */

:root {
  /* Palette — manuscript paper, fountain-pen ink, proofreader's pen */
  --paper:        #F7F3EB;
  --paper-deep:   #EDE6D6;  /* slightly darker paper for cards/wash */
  --ink:          #1A2238;  /* fountain-pen blue-black (primary text) */
  --ink-soft:     #4A506A;  /* muted ink for secondary text */
  --proof:        #D62828;  /* proofreader's red pen — the accent */
  --proof-deep:   #A81E1E;
  --annotate:     #3A6EA5;  /* annotation blue for margins/footnotes */
  --highlight:    #F2D63C;  /* highlighter yellow — used very sparingly */
  --line:         #D8CFBC;  /* hairline rules on paper */

  /* Type */
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body:    "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Layout */
  --maxw: 1080px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --section-pad: clamp(4.5rem, 11vw, 9rem);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  /* faint manuscript texture: ruled tint + grain */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(26, 34, 56, 0.035) 1px, transparent 0);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1.02rem, 0.55vw + 0.9rem, 1.18rem);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.04; margin: 0; letter-spacing: -0.01em; }

a { color: var(--ink); text-underline-offset: 0.18em; }

p { margin: 0 0 1.1rem; }

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

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; z-index: 100; border-radius: 0 0 6px 0;
  font-family: var(--mono); font-size: 0.8rem;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2.5px solid var(--proof);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem var(--gutter);
  background: rgba(247, 243, 235, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.wordmark { display: flex; align-items: baseline; gap: 0.5rem; text-decoration: none; color: var(--ink); }
.wordmark__rf {
  font-family: var(--display); font-weight: 900; font-size: 1.35rem;
  border: 2px solid var(--ink); border-radius: 7px;
  padding: 0.05em 0.32em; line-height: 1;
  transform: rotate(-3deg);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.wordmark:hover .wordmark__rf { transform: rotate(3deg); background: var(--proof); border-color: var(--proof); color: var(--paper); }
.wordmark__full { font-family: var(--display); font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; }

.site-nav { display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.9rem); }
.site-nav a {
  font-family: var(--mono); font-size: 0.82rem; text-decoration: none;
  color: var(--ink-soft); letter-spacing: -0.01em;
  transition: color 0.2s ease;
}
.site-nav a:hover { color: var(--ink); }
.site-nav__cta {
  color: var(--proof) !important; border: 1.5px solid var(--proof);
  padding: 0.4em 0.9em; border-radius: 999px;
}
.site-nav__cta:hover { background: var(--proof); color: var(--paper) !important; }

/* ---------- Shared section scaffolding ---------- */
.section {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: var(--section-pad) var(--gutter);
  border-top: 1px solid var(--line);
}

.section__label {
  font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--annotate);
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.6rem;
}
.section__label span {
  color: var(--proof); border: 1.5px solid currentColor;
  border-radius: 50%; width: 1.9em; height: 1.9em;
  display: inline-grid; place-items: center; font-weight: 700; font-size: 0.7rem;
}

.section__heading {
  font-size: clamp(2rem, 5vw, 3.2rem);
  max-width: 16ch; margin-bottom: 2.5rem;
}

/* ---------- Footnote markers ---------- */
.fn { text-decoration: none; color: var(--proof); font-family: var(--mono); }
/* Padding is reserved at all times so the highlight on hover never reflows the text. */
.fn sup {
  font-size: 0.62em; font-weight: 700;
  padding: 0.1em 0.28em; margin-left: 0.04em; border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease;
}
.fn:hover sup, .fn:focus-visible sup { background: var(--proof); color: var(--paper); }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw); margin-inline: auto;
  padding: clamp(3.5rem, 9vw, 7rem) var(--gutter) clamp(3rem, 7vw, 5rem);
}

.eyebrow {
  font-family: var(--mono); font-size: clamp(0.72rem, 1.5vw, 0.85rem);
  letter-spacing: 0.05em; color: var(--ink-soft); margin: 0 0 1.4rem;
}
.eyebrow__dot { color: var(--proof); padding: 0 0.3em; }

.hero__heading {
  font-size: clamp(2.9rem, 10vw, 6.4rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  max-width: 14ch;
  margin-bottom: 1.8rem;
}

/* the self-editing strikethrough device */
.edit { position: relative; display: inline-block; white-space: nowrap; }
.edit__struck {
  position: relative; color: var(--ink-soft); font-style: italic;
}
.edit__struck::after {
  content: ""; position: absolute; left: -4%; right: -4%; top: 52%;
  height: 0.09em; background: var(--proof);
  transform: scaleX(0); transform-origin: left center;
}
.edit__sub {
  color: var(--proof); font-style: italic; font-weight: 600;
  margin-left: 0.22em;
  display: inline-block;
  opacity: 0; transform: translateY(-0.18em) rotate(-2deg);
}
/* run the edit once the page is ready */
.edit.is-editing .edit__struck::after { animation: strike 0.55s ease forwards 0.4s; }
.edit.is-editing .edit__sub { animation: scribble 0.45s ease forwards 0.95s; }

@keyframes strike { to { transform: scaleX(1); } }
@keyframes scribble { to { opacity: 1; transform: translateY(0) rotate(-2deg); } }

.hero__lede {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-family: var(--display); font-weight: 400;
  color: var(--ink); max-width: 40ch; line-height: 1.45;
  margin-bottom: 2.4rem;
}

.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.4rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font-family: var(--mono); font-size: 0.9rem; font-weight: 700;
  text-decoration: none; padding: 0.85em 1.5em; border-radius: 999px;
  border: 2px solid var(--ink); transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--proof); border-color: var(--proof); transform: translateY(-2px); box-shadow: 0 8px 0 -2px rgba(26,34,56,0.18); }
.btn--big { font-size: clamp(0.95rem, 2.4vw, 1.25rem); padding: 1em 1.7em; }

/* status pill with live dot */
.status {
  font-family: var(--mono); font-size: 0.85rem; color: var(--ink-soft);
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.5em;
}
.status:hover { color: var(--ink); }
.status strong { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--highlight); }
.status__dot, .tag__dot {
  width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--proof);
  display: inline-block; position: relative; flex: none;
}
.status__dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--proof); animation: pulse 2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3); opacity: 0; } }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.about__heading {
  font-size: clamp(1.7rem, 4vw, 2.7rem); font-weight: 600; line-height: 1.1;
}

/* CEO polaroid — the image already carries its own frame, caption and shadow,
   so we only tilt it and pin it to the page like a scrapbook print. */
.polaroid {
  position: relative; margin: 2.4rem 0 0; max-width: 340px;
  transform: rotate(-2.5deg); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.polaroid img { display: block; width: 100%; height: auto; }
.polaroid::before {
  content: ""; position: absolute; z-index: 2; top: -12px; left: 50%;
  width: 92px; height: 26px;
  transform: translateX(-50%) rotate(-3.5deg);
  background: rgba(242, 214, 60, 0.5);   /* translucent highlighter-yellow tape */
  border: 1px solid rgba(242, 214, 60, 0.65);
  box-shadow: 0 1px 3px rgba(26, 34, 56, 0.12);
}
.polaroid:hover, .polaroid:focus-within { transform: rotate(0deg) scale(1.015); }
.about__body { font-size: 1.08rem; }
.about__body p:last-of-type { margin-bottom: 0; }
.hl { background: linear-gradient(180deg, transparent 58%, var(--highlight) 58%); padding: 0 0.05em; }
.about__sign { font-family: var(--display); font-style: italic; font-size: 1.25rem; margin-top: 1.6rem; }
.about__sign-aside { color: var(--proof); }

/* ---------- Principles ---------- */
.principles {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
}
.principle { background: var(--paper); padding: clamp(1.5rem, 3vw, 2.4rem); }
.principle__title {
  font-size: 1.35rem; font-weight: 600; margin-bottom: 0.5rem;
  display: flex; align-items: baseline; gap: 0.5rem;
}
.principle__title::before {
  content: ""; width: 0.7em; height: 0.7em; flex: none;
  border: 2px solid var(--proof); transform: rotate(45deg);
}
.principle p { color: var(--ink-soft); font-size: 0.98rem; margin: 0; }

/* ---------- Projects ---------- */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.project {
  background: var(--paper); border: 1.5px solid var(--ink);
  border-radius: 12px; padding: 1.7rem; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.project--live { box-shadow: 6px 6px 0 -1px var(--ink); }
.project--live:hover { transform: translate(-2px, -2px); box-shadow: 9px 9px 0 -1px var(--proof); }
.project--lab, .project--soon { border-style: dashed; border-color: var(--ink-soft); }
.project--lab:hover, .project--soon:hover { transform: translateY(-3px); box-shadow: 0 10px 22px -12px rgba(26,34,56,0.4); }

.project__top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.9rem; }
.project__name { font-size: 1.55rem; font-weight: 600; }

.tag {
  font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0.35em 0.7em; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 0.45em; white-space: nowrap;
}
.tag--live { background: var(--ink); color: var(--paper); }
.tag--live .tag__dot { background: #6ee787; }
.tag--lab { border: 1.5px solid var(--annotate); color: var(--annotate); }
.tag--soon { border: 1.5px solid var(--ink-soft); color: var(--ink-soft); }

.project__desc { color: var(--ink-soft); font-size: 0.96rem; margin-bottom: 1.2rem; }
.project--live .project__desc { color: var(--ink); }

.redacted {
  background: var(--ink); color: var(--ink); border-radius: 2px;
  user-select: none; letter-spacing: -0.05em; padding: 0 0.1em;
}

.project__meta {
  list-style: none; margin: 0 0 1.4rem; padding: 0; margin-top: auto;
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.project__meta li {
  font-family: var(--mono); font-size: 0.68rem; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 5px; padding: 0.25em 0.55em;
}

.project__link {
  font-family: var(--mono); font-size: 0.88rem; font-weight: 700;
  text-decoration: none; color: var(--proof);
  display: inline-flex; align-items: center; gap: 0.4em;
}
.project__link .project__arrow { transition: transform 0.2s ease; }
.project__link:hover .project__arrow { transform: translateX(4px); }
.project__link--muted { color: var(--ink-soft); font-weight: 400; cursor: default; }
a.project__link--muted { cursor: pointer; }
a.project__link--muted:hover { color: var(--ink); }

/* ---------- Contact ---------- */
.section--contact { text-align: center; }
.section--contact .section__label { justify-content: center; }
.contact__heading { font-size: clamp(1.8rem, 5vw, 3.2rem); margin-bottom: 1.2rem; }
.contact__body { color: var(--ink-soft); max-width: 38ch; margin: 0 auto 2.2rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 2px solid var(--ink); margin-top: 2rem; }
.footnotes {
  max-width: var(--maxw); margin-inline: auto; padding: 3rem var(--gutter) 1rem;
}
.footnotes__heading {
  font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--ink-soft); font-weight: 700; margin-bottom: 1.2rem;
}
.footnotes__list { font-size: 0.92rem; color: var(--ink-soft); padding-left: 1.4rem; margin: 0; }
.footnotes__list li { margin-bottom: 0.75rem; padding-left: 0.3rem; }
.footnotes__list li::marker { color: var(--proof); font-family: var(--mono); }
.fn-back { color: var(--annotate); text-decoration: none; padding-left: 0.3em; }
.fn-back:hover { color: var(--proof); }

.colophon {
  max-width: var(--maxw); margin-inline: auto;
  padding: 2rem var(--gutter) 3rem; border-top: 1px solid var(--line);
  display: grid; gap: 0.4rem;
  font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft);
}
.colophon__brand { font-family: var(--display); font-size: 1.1rem; font-weight: 600; color: var(--ink); margin: 0; }
.colophon p { margin: 0; }
.colophon__tag { color: var(--proof); }

/* ---------- Margin note (desktop footnote hover) ---------- */
.margin-note {
  position: fixed; z-index: 60; max-width: 240px;
  background: var(--ink); color: var(--paper);
  font-family: var(--body); font-size: 0.82rem; line-height: 1.45;
  padding: 0.7rem 0.85rem; border-radius: 8px;
  box-shadow: 0 12px 30px -10px rgba(26,34,56,0.5);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.margin-note.is-visible { opacity: 1; transform: translateY(0); }
.margin-note::before {
  content: "note"; display: block; font-family: var(--mono);
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--highlight); margin-bottom: 0.25rem;
}

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .polaroid { margin-inline: auto; }
  .projects { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .wordmark__full { display: none; }
  .site-nav { gap: 0.85rem; }
  .site-nav a:not(.site-nav__cta) { display: none; }
  .hero__actions { gap: 1rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .edit__struck::after { transform: scaleX(1); }
  .edit__sub { opacity: 1; transform: none; }
  .reveal { opacity: 1; transform: none; }
}
