/* =========================================================================
   Margin.House - shared styles
   Visual system per brand handoff. Light mode default.
   Saturation for moments (brand palette), restraint for duration (deck palette).
   No gradients, no glow, no drop shadows on the mark, no em-dashes in copy.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root {
  /* Brand palette - moments only (hero, CTAs, identity) */
  --pine:      #36492E;
  --lichen:    #7A8654;
  --oak:       #B89240;
  --cedar:     #7A4F2E;
  --parchment: #EFE8D6;
  --soil:      #2A2620;
  --bark:      #9B8060;

  /* Deck palette - duration (body content, long reads) */
  --pine-muted: #4A5A42;
  --sage:       #8A9472;
  --brass:      #A8895A;
  --bark-muted: #6B5C48;
  --paper:      #F2EDE0;
  --ink:        #2D2A24;
  --stone:      #6B6660;

  /* Type */
  --serif: 'Crimson Pro', 'Crimson Text', 'Source Serif Pro', Cambria, serif;
  --sans:  'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, ui-monospace, monospace;

  /* Layout */
  --measure: 44rem;     /* editorial reading column */
  --wide:    66rem;     /* nav, footer, hero band */
  --gap:     clamp(2.5rem, 6vw, 5rem);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--pine-muted); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--pine); }

/* ---------- refinements (chrome + micro-interactions) ----------
   Brought over from the Foundation app's restyle: crisper rendering, quiet
   scrollbars, soft selection, one calm motion curve. Editorial type system
   above is unchanged. */
body { -moz-osx-font-smoothing: grayscale; }

/* Sans / UI chrome picks up Inter's refined glyph features. */
.ui, .meta, nav, .site-footer, .cta,
.nav-mobile summary, .backlink, .byline, .label, .eyebrow, .tagline {
  font-feature-settings: 'cv11', 'ss01';
}

/* Quiet, thin warm scrollbars, matching the app. */
* { scrollbar-width: thin; scrollbar-color: var(--brass) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background-color: var(--brass); border-radius: 9999px;
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--bark); }

/* Soft Oak selection. */
::selection { background: rgba(184, 146, 64, 0.22); color: var(--soil); }

/* One calm motion curve for interactive chrome. */
a, .cta, summary, button {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 120ms;
}

/* ---------- type scale ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 700; color: var(--pine-muted); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2.75rem, 6vw, 4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(2rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.375rem, 2.4vw, 1.625rem); }
p  { margin: 0 0 1.1em; }

.eyebrow,
.label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.6875rem;          /* 11px */
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--pine-muted);
}

.tagline {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(0.75rem, 1.4vw, 0.875rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cedar);   /* warm wood tone, passes WCAG AA on Paper; Oak reserved for decorative accents */
}

/* small UI / metadata text uses the sans face */
.ui, .meta, nav, .site-footer { font-family: var(--sans); }
.meta { font-size: 0.8125rem; color: var(--stone); }

/* ---------- layout helpers ---------- */
.wrap { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); }
.measure { max-width: var(--measure); }
.section { padding-block: var(--gap); }
.center { text-align: center; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--brass);
}
.nav-wrap {
  max-width: var(--wide); margin-inline: auto;
  padding: 0.9rem clamp(1.25rem, 5vw, 2.5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--pine); }
.brand:hover { color: var(--pine); }
.brand .mark { width: 30px; height: 30px; }
.brand .wordmark {
  font-family: var(--serif); font-weight: 700; font-size: 1.3rem;
  color: var(--pine); letter-spacing: -0.01em; line-height: 1;
}

.nav-desktop { display: flex; align-items: center; gap: 1.6rem; font-size: 0.9rem; letter-spacing: -0.005em; }
.nav-desktop a { text-decoration: none; color: var(--ink); transition: color .12s cubic-bezier(.4,0,.2,1); }
.nav-desktop a:not(.cta):hover { color: var(--pine); }

.cta {
  display: inline-block; font-family: var(--sans); font-weight: 500;
  background: var(--pine); color: var(--parchment);
  padding: 0.55rem 1.1rem; border-radius: 6px; text-decoration: none;
  font-size: 0.9rem; line-height: 1; letter-spacing: -0.005em;
  transition: background .12s cubic-bezier(.4,0,.2,1), transform .12s cubic-bezier(.4,0,.2,1);
}
.cta:hover { background: var(--soil); color: var(--parchment); }
.cta:active { transform: translateY(1px); }
/* nav anchor selectors are more specific than .cta; restore button text color */
.nav-desktop a.cta, .nav-desktop a.cta:hover,
.nav-mobile .menu a.cta, .nav-mobile .menu a.cta:hover { color: var(--parchment); }

/* no-JS mobile menu via <details> */
.nav-mobile { display: none; position: relative; }
.nav-mobile summary {
  list-style: none; cursor: pointer; font-family: var(--mono); font-weight: 500;
  font-size: 0.6875rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--pine-muted); padding: 0.4rem 0.2rem;
}
.nav-mobile summary::-webkit-details-marker { display: none; }
.nav-mobile[open] summary { color: var(--pine); }
.nav-mobile .menu {
  position: absolute; right: 0; top: calc(100% + 0.6rem);
  background: var(--paper); border: 1px solid var(--brass);
  display: flex; flex-direction: column; min-width: 13rem; padding: 0.4rem;
}
.nav-mobile .menu a { text-decoration: none; color: var(--ink); padding: 0.7rem 0.8rem; font-size: 0.95rem; }
.nav-mobile .menu a:hover { background: var(--parchment); }
.nav-mobile .menu .cta { margin: 0.4rem; text-align: center; }

@media (max-width: 760px) {
  .nav-desktop { display: none; }
  .nav-mobile { display: block; }
}

/* ---------- hero ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 7rem) clamp(2.5rem, 6vw, 4.5rem); text-align: center; }
.hero .mark-hero { width: clamp(76px, 12vw, 104px); height: auto; margin: 0 auto 1.6rem; }
.hero h1 { color: var(--pine); margin-bottom: 0.7rem; }
.hero .tagline { display: block; margin-bottom: 1.6rem; }
.hero .lede {
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  color: var(--ink); max-width: 34rem; margin: 0 auto 2rem;
}
.hero .cta { font-size: 0.95rem; padding: 0.7rem 1.4rem; }

/* hairline divider */
.rule { border: 0; border-top: 1px solid var(--brass); margin: 0; }
.rule-soft { border: 0; border-top: 1px solid var(--bark); opacity: 0.5; margin: 0; }

/* ---------- three blocks ---------- */
.blocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 4vw, 3rem); }
.block { padding-top: 1.25rem; border-top: 2px solid var(--brass); }
.block h3 { margin-bottom: 0.6rem; }
.block p { font-size: 1.0625rem; line-height: 1.55; margin-bottom: 0; }
@media (max-width: 760px) { .blocks { grid-template-columns: 1fr; } }

/* ---------- generic page content ---------- */
.page-head { padding-block: clamp(2.75rem, 7vw, 4.5rem) clamp(1.5rem, 3vw, 2rem); }
.page-head .eyebrow { display: block; margin-bottom: 0.9rem; }
.page-head h1 { color: var(--pine); }
.page-head .lede { font-size: clamp(1.125rem, 2vw, 1.3rem); color: var(--ink); margin-top: 1rem; max-width: 42rem; }

.content h2 { margin-top: 0; margin-bottom: 0.6rem; }
.content .stack > * + * { margin-top: 0; }
.content section + section { margin-top: clamp(2.5rem, 5vw, 3.75rem); }
.content section .label { display: block; margin-bottom: 0.6rem; }
.content p { font-size: 1.0625rem; }

/* pull quote */
.pull {
  font-style: italic; font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  color: var(--pine-muted); line-height: 1.4;
  border-top: 1px solid var(--brass); border-bottom: 1px solid var(--brass);
  padding-block: 1.4rem; margin-block: 2.2rem;
}

/* founder layout */
.founder { display: grid; grid-template-columns: 240px 1fr; gap: clamp(1.75rem, 4vw, 3rem); align-items: start; }
.portrait {
  width: 100%; aspect-ratio: 4 / 5; background: var(--parchment);
  border: 1px solid var(--bark); object-fit: cover; display: block;
}
.founder dl { margin: 0; }
.founder dt { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--pine-muted); margin-top: 1.2rem; }
.founder dd { margin: 0.25rem 0 0; font-family: var(--sans); font-size: 0.95rem; color: var(--ink); }
@media (max-width: 680px) { .founder { grid-template-columns: 1fr; } .portrait { max-width: 220px; } }

/* contact */
.contact-block { margin-top: 1.5rem; }
.contact-block .big-link { font-family: var(--serif); font-size: clamp(1.4rem, 4vw, 2rem); color: var(--pine); text-decoration: none; }
.contact-block .big-link:hover { text-decoration: underline; text-decoration-color: var(--oak); }
.contact-meta { font-family: var(--sans); font-size: 0.95rem; color: var(--stone); margin-top: 1.75rem; line-height: 1.9; }
.contact-meta a { color: var(--pine-muted); }

/* decorative cabin band (home, atmosphere only) */
.atmos { padding-block: clamp(2rem, 5vw, 3.5rem); text-align: center; }
.atmos svg { width: clamp(200px, 40vw, 320px); margin: 0 auto; opacity: 0.92; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--brass); background: var(--paper); margin-top: clamp(3rem, 7vw, 5rem); }
.footer-grid {
  max-width: var(--wide); margin-inline: auto;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.25rem, 5vw, 2.5rem);
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.5rem; align-items: start;
}
.footer-brand { display: flex; align-items: center; gap: 0.6rem; }
.footer-brand .mark { width: 26px; height: 26px; }
.footer-brand .wm { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; color: var(--pine); line-height: 1; }
.footer-loc { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); margin-top: 0.5rem; }
.footer-nav { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; }
.footer-nav a { color: var(--ink); text-decoration: none; }
.footer-nav a:hover { color: var(--pine); }
.footer-right { text-align: right; font-size: 0.8125rem; color: var(--stone); line-height: 1.9; }
.footer-right a { color: var(--pine-muted); text-decoration: none; }
.footer-right a:hover { color: var(--pine); }
.footer-label { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--pine-muted); }
@media (max-width: 680px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; text-align: left; }
  .footer-right { text-align: left; }
}

/* ---------- a11y ---------- */
:focus-visible { outline: 2px solid var(--oak); outline-offset: 2px; }
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--pine); color: var(--parchment); padding: 0.6rem 1rem;
  font-family: var(--sans); font-size: 0.9rem; z-index: 100;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

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

/* ---------- founder-forward hero (home) ---------- */
.hero-lead { padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2rem, 5vw, 3.5rem); }
.hero-lead .eyebrow { display: block; margin-bottom: 0.7rem; }
.hero-lead h1 { color: var(--pine); font-size: clamp(2.9rem, 7vw, 4.5rem); margin: 0 0 1.25rem; }
.hero-credential { font-size: clamp(1.15rem, 2.1vw, 1.4rem); line-height: 1.55; color: var(--ink); max-width: 46rem; }
.hero-credential strong { font-weight: 700; color: var(--pine-muted); }
.hero-bridge { font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: var(--pine-muted); max-width: 42rem; margin-top: 1.2rem; }
.hero-lead .cta { margin-top: 1.9rem; font-size: 0.95rem; padding: 0.7rem 1.4rem; }

/* ---------- selected work cards ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2rem); }
.section-head .more { font-family: var(--sans); font-size: 0.875rem; white-space: nowrap; }
.workcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.25rem, 3vw, 2.25rem); }
.workcard { border-top: 2px solid var(--brass); padding-top: 1.1rem; }
.workcard .label { display: block; margin-bottom: 0.5rem; }
.workcard h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.workcard p { font-size: 1rem; line-height: 1.5; margin-bottom: 0; }
@media (max-width: 760px) { .workcards { grid-template-columns: 1fr; } }

/* ---------- work page case studies ---------- */
.case { border-top: 1px solid var(--brass); padding-top: 1.5rem; }
.case + .case { margin-top: clamp(2.5rem, 5vw, 3.75rem); }
.case .label { display: block; margin-bottom: 0.6rem; }
.case h2 { font-size: clamp(1.5rem, 2.8vw, 1.9rem); margin-bottom: 0.7rem; }
.case .result {
  font-family: var(--sans); font-size: 0.95rem; color: var(--pine-muted);
  border-left: 2px solid var(--brass); padding-left: 0.9rem; margin-top: 1rem;
}
.case .result strong { color: var(--pine); font-weight: 600; }

/* ---------- thinking: article pages ---------- */
.byline { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); margin-top: 0.9rem; }
.article-body { margin-top: 1.75rem; }
.article-body h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); margin: 2.5rem 0 0.7rem; }
.article-body p { font-size: 1.0625rem; line-height: 1.72; }
.article-body p strong { color: var(--ink); font-weight: 700; }
.article-body > p:first-of-type { font-size: 1.1875rem; line-height: 1.62; color: var(--ink); }

.related { border: 1px solid var(--brass); border-radius: 8px; padding: 1.15rem 1.35rem; margin-top: 2.75rem; }
.related .label { display: block; margin-bottom: 0.45rem; }
.related p { margin: 0; font-size: 1rem; line-height: 1.5; }
.related a { font-weight: 500; }

.backlink { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.15em; text-transform: uppercase; text-decoration: none; color: var(--pine-muted); }
.backlink:hover { color: var(--pine); }

/* ---------- thinking: index ---------- */
.thinking-item { border-top: 1px solid var(--brass); padding: 1.9rem 0; }
.thinking-item:last-child { border-bottom: 1px solid var(--brass); }
.thinking-item .date { display: block; font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); margin-bottom: 0.5rem; }
.thinking-item h2 { font-size: clamp(1.6rem, 3vw, 2.05rem); margin-bottom: 0.55rem; line-height: 1.2; }
.thinking-item h2 a { color: var(--pine-muted); text-decoration: none; }
.thinking-item h2 a:hover { color: var(--pine); text-decoration: underline; text-decoration-color: var(--brass); }
.thinking-item p { font-size: 1.125rem; margin: 0; color: var(--ink); max-width: 46rem; }

/* clickable workcard titles (used for recent thinking on home) */
.workcard h3 a { color: inherit; text-decoration: none; }
.workcard h3 a:hover { text-decoration: underline; text-decoration-color: var(--brass); }

/* read-the-thinking link inside work cases */
.case .readmore { display: block; margin-top: 0.9rem; font-family: var(--sans); font-size: 0.9rem; }

/* privacy: last-updated line */
.content .updated { font-family: var(--sans); font-size: 0.85rem; color: var(--stone); margin-top: 1.5rem; }
