/* ============================================================
   DESIGN SYSTEM — CSS CUSTOM PROPERTIES
   To re-skin: change --blue and --blue-deep here.
   Update the rgba() in --hairline to match the new --blue RGB.
   ============================================================ */
:root {
  /* ── Brand palette (Style Guide Maggio 2024) ────────────── */
  --blue:        #3D4F63;   /* primary brand blue-slate        */
  --blue-deep:   #2A3A4E;   /* darker shade for hover & CTAs   */
  --ivory:       #FAF7F2;   /* warm page background            */
  --paper:       #FFFFFF;   /* card / modal surfaces           */
  --ink:         #3A3A3A;   /* primary text (brand charcoal)   */
  --muted:       #7A7C80;   /* secondary / caption text        */
  --warm:        #DBD1C3;   /* brand warm beige accent         */
  --hairline:    rgba(61, 79, 99, 0.14); /* --blue @ 14% opacity */

  --container-max:    1180px;
  --container-gutter: 24px;

  /* Spacing scale (8px base) */
  --s1:  8px;
  --s2:  16px;
  --s3:  24px;
  --s4:  32px;
  --s5:  40px;
  --s6:  48px;
  --s8:  64px;
  --s10: 80px;
  --s12: 96px;
  --s14: 112px;
  --s16: 128px;
  --s20: 160px;
  --s25: 200px;
  --s30: 240px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background-color: var(--ivory);
  color: var(--ink);
  font-family: 'Garet', system-ui, sans-serif;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
   SKIP LINK
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--container-gutter);
  background: var(--blue);
  color: var(--ivory);
  padding: 12px 20px;
  font-family: 'Garet', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  border-radius: 0 0 4px 4px;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ============================================================
   FOCUS RING
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-gutter);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: clamp(2.8rem, 6.5vw, 5.5rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-optical-sizing: auto;
  color: var(--ink);
}

h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.14;
  font-optical-sizing: auto;
  color: var(--ink);
}

h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: 1.375rem;
  line-height: 1.3;
}

p {
  max-width: 60ch;
  color: var(--ink);
}

.eyebrow {
  font-family: 'Garet', sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
  max-width: none;
}

.eyebrow-light {
  color: rgba(250, 247, 242, 0.60);
}

.subtext {
  font-family: 'Garet', sans-serif;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
  max-width: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  font-family: 'Garet', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 18px 34px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 250ms ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--blue);
  color: var(--ivory);
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--blue-deep);
  outline-color: var(--ivory);
}

.btn-large {
  font-size: 0.9375rem;
  padding: 22px 48px;
}

.btn-secondary {
  background: none;
  color: var(--blue);
  padding: 0;
  border-radius: 0;
  letter-spacing: 0.06em;
  text-transform: none;
  font-size: 0.9375rem;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--blue);
  background-image: linear-gradient(var(--blue), var(--blue));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 250ms ease;
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  background-size: 100% 1px;
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--ivory);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}
.nav.scrolled {
  border-bottom-color: var(--hairline);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}
.nav-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.nav-logo {
  height: 36px;
  width: auto;
  display: block;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 92vh;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-gutter);
  padding-top: var(--s10);
  padding-bottom: var(--s8);
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: var(--s8);
  align-items: center;
  /* subtle warm tint at the very top */
  background: linear-gradient(to bottom, rgba(44, 74, 138, 0.03) 0%, transparent 36%);
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  align-items: flex-start;
}

.hero-body {
  max-width: 48ch;
}

.hero-image img {
  width: 100%;
  max-height: 700px;
  object-fit: cover;
  object-position: center top;
  border-radius: 3px;
  aspect-ratio: 4/5;
}

/* ============================================================
   STORY
   ============================================================ */
.story {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-gutter);
  padding-top: var(--s12);
  padding-bottom: var(--s12);
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: var(--s8);
  align-items: start;
}

.story-text {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.story-text p {
  max-width: 56ch;
}

/* Certification line: hairline above, muted text */
.cert-line {
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--hairline);
  font-family: 'Garet', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
  max-width: none !important;
}

.signature {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--blue);
  max-width: none !important;
  margin-top: var(--s1);
}

.story-image {
  margin-top: 64px; /* intentional offset for asymmetric rhythm */
}
.story-image img {
  width: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 3px;
  aspect-ratio: 4/5;
}

/* ============================================================
   THE LIST
   ============================================================ */
.the-list {
  background-color: var(--ivory);
  padding-top: var(--s12);
  padding-bottom: var(--s12);
  text-align: center;
}

.the-list-inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
}

.list-body {
  max-width: 52ch;
  text-align: center;
}

/* ============================================================
   ETHICS LINE
   ============================================================ */
.ethics {
  background-color: var(--ivory);
  padding-top: var(--s4);
  padding-bottom: var(--s4);
  border-top: 1px solid var(--hairline);
}

.ethics p {
  font-family: 'Garet', sans-serif;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 64ch;
  text-align: center;
  margin-inline: auto;
  line-height: 1.7;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background-color: var(--ivory);
  border-top: 1px solid var(--hairline);
  padding-top: var(--s6);
  padding-bottom: var(--s4);
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s8);
}

.footer-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
  font-size: 1.5rem;
  color: var(--ink);
  max-width: none;
  margin-bottom: 6px;
}

.footer-tagline {
  font-family: 'Garet', sans-serif;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: none;
}

.footer-right {
  display: flex;
  gap: var(--s4);
  align-items: center;
  flex-shrink: 0;
}

.footer-link {
  font-family: 'Garet', sans-serif;
  font-size: 0.875rem;
  color: var(--blue);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: border-color 200ms ease;
}
.footer-link:hover,
.footer-link:focus-visible {
  border-bottom-color: var(--blue);
}

.footer-bottom {
  padding-top: var(--s3);
  border-top: 1px solid var(--hairline);
}

.footer-copy {
  font-family: 'Garet', sans-serif;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: none;
}

/* ============================================================
   SUBSTACK BAR (footer)
   ============================================================ */
.substack-bar {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  align-items: flex-end;
  background-color: var(--blue);
  border-radius: 4px;
  padding: 20px 24px;
}

.substack-label {
  font-family: 'Garet', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(250, 247, 242, 0.75);
}

.substack-row {
  display: flex;
  gap: var(--s2);
  align-items: stretch;
}

.substack-input {
  font-family: 'Garet', sans-serif;
  font-size: 0.875rem;
  color: var(--ink);
  background: var(--ivory);
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 12px 16px;
  width: 220px;
  outline: none;
  transition: border-color 200ms ease;
}
.substack-input::placeholder {
  color: var(--muted);
}
.substack-input:focus {
  border-color: var(--warm);
}

.substack-btn {
  white-space: nowrap;
  font-size: 0.8125rem;
  padding: 12px 24px;
  background-color: var(--ivory);
  color: var(--blue);
}
.substack-btn:hover,
.substack-btn:focus-visible {
  background-color: var(--warm);
  color: var(--ink);
}

/* ============================================================
   CONTACT MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s3);
}
.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 24, 29, 0.55);
  cursor: pointer;
}

.modal-box {
  position: relative;
  background: var(--ivory);
  border-radius: 4px;
  padding: 48px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 2px;
  transition: color 200ms ease;
}
.modal-close:hover,
.modal-close:focus-visible {
  color: var(--ink);
}

.modal-box h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.modal-intro {
  font-size: 0.9375rem;
  color: var(--muted);
  max-width: none;
}

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-family: 'Garet', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
}

.field label span {
  color: var(--blue);
}

.field input,
.field textarea {
  font-family: 'Garet', sans-serif;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 13px 16px;
  width: 100%;
  outline: none;
  transition: border-color 200ms ease;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}
.field input:focus,
.field textarea:focus {
  border-color: var(--blue);
}

.btn-full {
  width: 100%;
  text-align: center;
  margin-top: var(--s1);
}
.btn-full:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-status {
  font-family: 'Garet', sans-serif;
  font-size: 0.875rem;
  padding: 12px 16px;
  border-radius: 3px;
  max-width: none;
}
.form-status--success {
  background: rgba(44, 74, 138, 0.08);
  color: var(--blue-deep);
}
.form-status--error {
  background: rgba(180, 40, 40, 0.07);
  color: #8B1A1A;
}

/* Modal responsive */
@media (max-width: 480px) {
  .modal-box {
    padding: 32px 24px;
  }
  .substack-bar {
    align-items: flex-start;
  }
  .substack-row {
    flex-direction: column;
    width: 100%;
  }
  .substack-input {
    width: 100%;
  }
}

/* ============================================================
   ANIMATION — visible only when JS fires, reduced-motion safe
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .animate-in {
    opacity: 0;
    transform: translateY(16px);
    transition:
      opacity 700ms cubic-bezier(0.2, 0.6, 0.2, 1),
      transform 700ms cubic-bezier(0.2, 0.6, 0.2, 1);
    transition-delay: calc(var(--stagger, 0) * 80ms);
  }
  .animate-in.visible {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .animate-in {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   RESPONSIVE — 1024px
   ============================================================ */
@media (max-width: 1024px) {
  .hero {
    gap: var(--s6);
    padding-top: var(--s8);
    padding-bottom: var(--s6);
  }
  .story {
    padding-top: var(--s10);
    padding-bottom: var(--s10);
    gap: var(--s6);
  }
  .dark-block {
    padding-top: var(--s14);
    padding-bottom: var(--s14);
  }
  .the-list {
    padding-top: var(--s10);
    padding-bottom: var(--s10);
  }
}

/* ============================================================
   RESPONSIVE — 768px (tablet → single column)
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --s25: 128px;
    --s30: 128px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: var(--s8);
    padding-bottom: var(--s8);
    gap: var(--s5);
    background: none;
  }
  /* Portrait above the text on mobile */
  .hero-image {
    order: -1;
  }
  .hero-image img {
    max-height: 480px;
    aspect-ratio: 3/4;
  }

  .story {
    grid-template-columns: 1fr;
    padding-top: var(--s8);
    padding-bottom: var(--s8);
    gap: var(--s5);
  }
  .story-image {
    margin-top: 0;
  }

  .dark-cols {
    grid-template-columns: 1fr;
  }
  .dark-col + .dark-col {
    border-left: none;
    border-top: 1px solid rgba(250, 247, 242, 0.16);
  }

  .footer-inner {
    flex-direction: column;
    gap: var(--s4);
  }
  .footer-right {
    flex-direction: row;
    gap: var(--s4);
  }
}

/* ============================================================
   RESPONSIVE — 480px (mobile)
   ============================================================ */
@media (max-width: 480px) {
  :root {
    --container-gutter: 20px;
    --s25: 80px;
    --s30: 80px;
  }

  .nav-inner {
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .nav-brand {
    font-size: 0.6875rem;
  }
  .btn {
    padding: 14px 24px;
    font-size: 0.75rem;
  }
  .btn-large {
    padding: 18px 36px;
    font-size: 0.875rem;
  }

  .story {
    padding-top: var(--s6);
    padding-bottom: var(--s6);
  }
  .the-list {
    padding-top: var(--s6);
    padding-bottom: var(--s6);
  }

  .footer-right {
    flex-direction: column;
    gap: var(--s2);
  }
}
