/* Self Publishing Legacy — stylesheet
   Palette: carta calda + inchiostro + oro/bronzo. Display serif (Fraunces) + sans (Inter). */

:root {
  --paper: #FAF7F1;
  --paper-2: #F2ECE1;
  --ink: #15120D;
  --ink-soft: #4A443B;
  --muted: #6B6458;
  --gold: #B0822E;
  --gold-soft: #C99A45;
  --gold-deep: #8C6420;
  --espresso: #1A1611;
  --espresso-2: #221D16;
  --cream: #F0E7D8;
  --line: rgba(21, 18, 13, 0.12);
  --line-light: rgba(240, 231, 216, 0.16);
  --shadow: 0 18px 50px -24px rgba(21, 18, 13, 0.45);
  --radius: 18px;
  --maxw: 1120px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

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

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* In-page anchor targets clear the sticky header; programmatic focus shows no ring */
main[id], section[id] { scroll-margin-top: 90px; }
[tabindex="-1"]:focus { outline: none; }

/* Footer variant + small utilities (kept as classes so pages carry no inline styles) */
.footer-bottom.bare { border-top: none; padding-top: 0; }
.link-inherit { color: inherit; transition: color 0.16s ease; }
.link-inherit:hover { color: var(--paper); }
.mt-8 { margin-top: 8px; }
.mt-28 { margin-top: 28px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-2px); background: #2a241c; box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-2); box-shadow: none; }
.btn-light { background: var(--gold-soft); color: var(--espresso); border-color: var(--gold-soft); }
.btn-light:hover { background: #d8ab59; }
.btn-small { padding: 10px 18px; font-size: 0.9rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 241, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 8px 30px -22px rgba(21, 18, 13, 0.5);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--serif);
  font-size: 1.14rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand-mark { flex: none; }
.brand-text em { font-style: italic; color: var(--gold-deep); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 30px;
}
.site-nav > a {
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.16s ease;
}
.site-nav > a:hover { color: var(--ink); }
.site-nav .nav-cta { color: var(--paper); }
.site-nav .nav-cta:hover { color: var(--paper); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 12vw, 150px) 0 clamp(64px, 10vw, 128px);
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(201, 154, 69, 0.16), transparent 55%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
}
.hero-bg {
  position: absolute;
  right: -8%;
  top: 50%;
  transform: translateY(-50%);
  width: min(620px, 70%);
  opacity: 0.7;
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 760px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-deep);
  margin-bottom: 22px;
}
.hero-title {
  font-size: clamp(2.35rem, 6vw, 4.1rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  max-width: 16ch;
}
.hero-sub {
  margin-top: 26px;
  font-size: clamp(1.08rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 56ch;
}
.hero-cta {
  margin-top: 38px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 120px) 0; }
.section-head { max-width: 640px; margin-bottom: clamp(40px, 5vw, 64px); }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gold-deep);
  margin-bottom: 16px;
}
.kicker-light { color: var(--gold-soft); }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
.section-lead {
  margin-top: 18px;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 30px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(176, 130, 46, 0.4); }
.card-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(176, 130, 46, 0.12);
  color: var(--gold-deep);
  margin-bottom: 22px;
}
.card h3 { font-size: 1.34rem; margin-bottom: 12px; }
.card p { color: var(--ink-soft); font-size: 1rem; }

/* Dark section */
.section-dark { background: var(--espresso); color: var(--cream); }
.section-dark h2, .section-dark h3 { color: var(--paper); }
.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 36px;
}
.principle { border-top: 1px solid var(--line-light); padding-top: 24px; }
.principle-num {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--gold-soft);
  letter-spacing: 0.05em;
}
.principle h3 { font-size: 1.45rem; margin: 14px 0 12px; }
.principle p { color: rgba(240, 231, 216, 0.74); }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 56px;
  align-items: start;
}
.about-text h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin-bottom: 22px; }
.about-text p { color: var(--ink-soft); font-size: 1.08rem; margin-bottom: 18px; max-width: 54ch; }
.about-aside {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 28px;
}
.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.facts li:last-child { border-bottom: none; }
.fact-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.fact-value { font-family: var(--serif); font-size: 1.18rem; color: var(--ink); }

/* Contact */
.section-contact {
  background:
    radial-gradient(90% 120% at 50% 0%, rgba(176, 130, 46, 0.22), transparent 60%),
    var(--espresso-2);
  color: var(--cream);
  text-align: center;
}
.contact-inner { max-width: 640px; margin: 0 auto; }
.section-contact h2 { color: var(--paper); font-size: clamp(2rem, 4.5vw, 3rem); margin-bottom: 18px; }
.contact-lead { color: rgba(240, 231, 216, 0.78); font-size: 1.12rem; margin-bottom: 34px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(240, 231, 216, 0.7); padding: 64px 0 32px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line-light);
}
.brand-footer { color: var(--paper); font-size: 1.1rem; }
.footer-tagline { margin-top: 16px; font-size: 0.96rem; max-width: 32ch; }
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col h3 {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--gold-soft);
  margin-bottom: 4px;
}
.footer-col a, .footer-static { font-size: 0.96rem; color: rgba(240, 231, 216, 0.72); transition: color 0.16s ease; }
.footer-col a:hover { color: var(--paper); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 28px;
  font-size: 0.86rem;
  color: rgba(240, 231, 216, 0.55);
}

/* ---------- Legal pages ---------- */
.site-nav-simple a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.16s ease;
}
.site-nav-simple a:hover { color: var(--ink); }

.legal {
  padding: clamp(48px, 7vw, 88px) 0 clamp(56px, 8vw, 96px);
  background:
    radial-gradient(120% 70% at 90% -10%, rgba(201, 154, 69, 0.1), transparent 55%),
    var(--paper);
}
.legal-inner { max-width: 760px; }
.legal-inner h1 { font-size: clamp(2.2rem, 5vw, 3.1rem); margin: 10px 0 6px; }
.legal-updated { color: var(--muted); font-size: 0.92rem; margin-bottom: 34px; }
.legal-inner h2 { font-size: 1.4rem; margin: 38px 0 12px; }
.legal-inner p { color: var(--ink-soft); font-size: 1.04rem; margin-bottom: 14px; }
.legal-inner a { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 2px; }
.legal-inner a:hover { color: var(--ink); }

/* ---------- Contact form ---------- */
.contact-form {
  margin: 38px auto 0;
  max-width: 580px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 38px);
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.55);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.req { color: var(--gold-deep); }
.field-optional { color: var(--muted); font-weight: 400; }

.contact-form input,
.contact-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  -webkit-appearance: none;
  appearance: none;
}
.contact-form textarea { min-height: 128px; resize: vertical; line-height: 1.55; }
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--muted); }
.contact-form input:hover,
.contact-form textarea:hover { border-color: rgba(21, 18, 13, 0.24); }
.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 130, 46, 0.28);
}
.contact-form .invalid {
  border-color: #B42318;
}
.contact-form .invalid:focus-visible {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.24);
}

/* Honeypot: hidden from people, reachable by bots */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.field-err {
  margin-top: 7px;
  font-size: 0.86rem;
  color: #B42318;
}

.contact-submit {
  position: relative;
  margin-top: 22px;
  min-width: 180px;
}
.contact-submit .btn-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(26, 22, 17, 0.35);
  border-top-color: var(--espresso);
  display: none;
}
.contact-form.is-sending .contact-submit { pointer-events: none; opacity: 0.85; }
.contact-form.is-sending .contact-submit .btn-spinner { display: inline-block; animation: spin 0.7s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.form-status {
  margin-top: 20px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.form-status.is-success {
  background: #E7F4EC;
  color: #1B5E3F;
  border: 1px solid #B7E0C6;
}
.form-status.is-error {
  background: #FBEAE8;
  color: #8A1C13;
  border: 1px solid #F1C4BF;
}

.contact-alt {
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.contact-alt a { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 2px; }
.contact-alt a:hover { color: var(--ink); }

/* ---------- Legal lists ---------- */
.legal-list {
  margin: 6px 0 14px;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 1.04rem;
}
.legal-list li { margin-bottom: 8px; }
.legal-inner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ---------- Thank-you page ---------- */
.thanks-inner { text-align: center; margin: 0 auto; }
.thanks-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(27, 94, 63, 0.12);
  color: #1B5E3F;
}
.thanks-inner .btn { text-align: center; }

/* ---------- Reveal animation ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px 24px 24px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }
  .site-nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .site-nav > a { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .site-nav .nav-cta { margin-top: 10px; border-bottom: none; text-align: center; }

  .cards { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; gap: 28px; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; gap: 0; margin-bottom: 18px; }
}

@media (max-width: 520px) {
  .container { padding: 0 18px; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-bg { opacity: 0.35; }
  .btn { width: 100%; }
  .hero-cta { flex-direction: column; }
  .contact-submit { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover { transform: none; }
  .contact-form.is-sending .contact-submit .btn-spinner { animation: none; }
}
