/* =========================================================================
   1732 Studios — house design system
   Ink on parchment. The page is the colophon of a small private press;
   color only floods in from the six editions. House accent is the pine.
   ========================================================================= */

/* ---- Tokens : day (default) -------------------------------------------- */
:root {
  --paper:        #F2E9D1;   /* parchment */
  --paper-raised: #FBF5E4;   /* plates, device matte */
  --paper-sunk:   #E8DDBE;   /* insets */
  --ink:          #1B2A37;   /* the logo navy */
  --ink-soft:     #45505B;   /* secondary copy */
  --sepia:        #6E6047;   /* warm labels, captions */
  --hairline:     rgba(27, 42, 55, 0.16);
  --hairline-bold:rgba(27, 42, 55, 0.34);
  --spruce:       #2E4A3A;   /* house accent — the pine */
  --spruce-bright:#3C6149;
  --shadow:       rgba(27, 31, 24, 0.16);
  --shadow-deep:  rgba(20, 24, 18, 0.28);
  --select:       rgba(46, 74, 58, 0.18);

  /* type */
  --font-display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --font-text:    "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --font-read:    "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;

  /* fluid scale */
  --t-mega:  clamp(3.4rem, 9vw, 6rem);
  --t-xl:    clamp(2.1rem, 5vw, 3.6rem);
  --t-lg:    clamp(1.6rem, 3vw, 2.3rem);
  --t-md:    clamp(1.2rem, 2vw, 1.45rem);
  --t-body:  clamp(1.02rem, 1.05rem + 0.2vw, 1.18rem);
  --t-small: 0.86rem;
  --t-label: 0.72rem;

  /* rhythm */
  --container: 1180px;
  --reading:   640px;
  --pad-x:     clamp(1.25rem, 4vw, 3rem);
  --section-y: clamp(4.5rem, 9vw, 8.5rem);
  --radius:    4px;

  color-scheme: light;
}

/* ---- Tokens : night ----------------------------------------------------- */
html[data-theme="night"] {
  --paper:        #131D26;
  --paper-raised: #1C2832;
  --paper-sunk:   #0E161D;
  --ink:          #ECE2CB;
  --ink-soft:     #A7B0B9;
  --sepia:        #9A8A69;
  --hairline:     rgba(236, 226, 203, 0.16);
  --hairline-bold:rgba(236, 226, 203, 0.32);
  --spruce:       #74A98A;
  --spruce-bright:#8FC2A4;
  --shadow:       rgba(0, 0, 0, 0.45);
  --shadow-deep:  rgba(0, 0, 0, 0.6);
  --select:       rgba(116, 169, 138, 0.22);
  color-scheme: dark;
}

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.62;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
  transition: background-color .6s ease, color .6s ease;
  overflow-x: hidden;
}

/* faint laid-paper tone — texture, not decoration */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,255,255,0.10), transparent 60%),
    radial-gradient(140% 120% at 50% 120%, rgba(0,0,0,0.05), transparent 55%);
  opacity: .9;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: var(--select); }

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

/* a11y: skip link (visible only when focused) */
.skip-link {
  position: absolute; left: .5rem; top: -3.5rem; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .55rem 1rem; border-radius: var(--radius);
  transition: top .2s ease;
}
.skip-link:focus { top: .5rem; }
main:focus { outline: none; }

/* ---- Type helpers ------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-text);
  font-size: var(--t-label);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--sepia);
  font-weight: 400;
}
.display { font-family: var(--font-display); font-weight: 400; line-height: 1.04; letter-spacing: .002em; }

/* ---- Layout ------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--pad-x); }
.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }

.section__head { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section__head .eyebrow { display: block; margin-bottom: 1rem; }
.section__title { font-family: var(--font-display); font-size: var(--t-xl); line-height: 1.06; font-weight: 400; }
.section__title em { font-style: italic; color: var(--spruce); }
.section__intro { margin-top: 1.15rem; max-width: 38rem; color: var(--ink-soft); font-size: var(--t-md); line-height: 1.5; }

/* ---- Site header -------------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem var(--pad-x);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.1) blur(10px);
  -webkit-backdrop-filter: saturate(1.1) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.masthead__brand { display: inline-flex; align-items: center; gap: .6rem; }
.masthead__brand .mark { width: 30px; height: 30px; color: var(--ink); }
.masthead__brand .word { font-family: var(--font-display); font-size: 1.18rem; letter-spacing: .02em; }
.masthead__brand .word b { font-weight: 400; }
.masthead__brand .word span { font-size: .62em; letter-spacing: .32em; padding-left: .35em; color: var(--sepia); text-transform: uppercase; }

.masthead__nav { display: flex; align-items: center; gap: clamp(.6rem, 2vw, 1.75rem); }
.navlink {
  font-size: var(--t-label); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft);
  padding: .35rem 0; position: relative; transition: color .25s ease;
}
.navlink::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1px;
  background: var(--spruce); transition: right .3s ease;
}
.navlink:hover { color: var(--ink); }
.navlink:hover::after { right: 0; }
.nav-hide-sm { display: inline; }

/* day / night toggle */
.daynight {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--hairline-bold); border-radius: 100px;
  padding: .3rem .5rem; color: var(--ink-soft);
}
.daynight svg { width: 15px; height: 15px; }
.daynight .sun  { display: block; }
.daynight .moon { display: none; }
html[data-theme="night"] .daynight .sun  { display: none; }
html[data-theme="night"] .daynight .moon { display: block; }
.daynight:hover { color: var(--ink); border-color: var(--spruce); }
.daynight--quiet { border-color: transparent; padding: .25rem .4rem; color: var(--sepia); }
.daynight--quiet:hover { color: var(--ink); border-color: var(--hairline-bold); }

/* ---- Buttons / App Store badge ----------------------------------------- */
.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.appstore {
  display: inline-flex; align-items: center; gap: .65rem;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1.1rem .7rem 1rem; border-radius: 10px;
  border: 1px solid transparent; transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
  box-shadow: 0 1px 0 var(--hairline);
}
.appstore svg { width: 22px; height: 22px; color: var(--paper); }
.appstore .lines { display: flex; flex-direction: column; line-height: 1.05; }
.appstore .lines small { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.appstore .lines strong { font-family: var(--font-display); font-weight: 400; font-size: 1.06rem; letter-spacing: .01em; }
.appstore:hover { transform: translateY(-2px); box-shadow: 0 10px 24px var(--shadow); }
.appstore[data-soon="true"] { cursor: default; }
.appstore[data-soon="true"]:hover { transform: none; box-shadow: 0 1px 0 var(--hairline); }

.btn-text {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: var(--t-small); letter-spacing: .06em; color: var(--ink);
  border-bottom: 1px solid var(--hairline-bold); padding-bottom: 2px;
  transition: border-color .25s ease, gap .25s ease;
}
.btn-text:hover { border-color: var(--spruce); gap: .75rem; }
.btn-text .arr { transition: transform .25s ease; }
.btn-text:hover .arr { transform: translateX(3px); }

/* ---- Pine-and-whoopie-pies divider ------------------------------------- */
.colophon-rule {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); margin-inline: auto;
}
.colophon-rule svg { width: min(420px, 70%); height: auto; opacity: .92; }
.section-rule { padding-block: clamp(1.5rem, 4vw, 3rem); }

/* whoopie-pie easter egg wobble */
.wp { transform-box: fill-box; transform-origin: center; cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
  .wp.nudge { animation: wp-wobble .7s ease; }
}
@keyframes wp-wobble {
  0%,100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-6px) rotate(-7deg); }
  60% { transform: translateY(0) rotate(5deg); }
}

/* ---- Hero --------------------------------------------------------------- */
.hero { padding-top: clamp(2rem, 5vw, 4rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.hero__grid {
  display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.hero__copy { max-width: 33rem; }
.hero__title {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--t-mega); line-height: 0.98; letter-spacing: -0.01em;
  margin-bottom: 1.4rem;
  text-wrap: balance;          /* even rag; keeps the line from overrunning the column */
  overflow-wrap: break-word;   /* safety net: never let a long token spill toward the device */
}
.hero__title em { font-style: italic; }
/* book title sitting under the big author/display name on an app page;
   tinted in the book's own accent (--spruce flips day<->night per page) */
.h1-work {
  display: block; margin-top: .5rem;
  font-size: var(--t-lg); font-style: italic; font-weight: 400;
  line-height: 1.12; letter-spacing: 0; color: var(--spruce);
}
/* Caslon carries no Cyrillic — set the Russian title in its own face (upright;
   Old Standard TT ships no italic, so this avoids a synthesized faux-slant) */
body[data-slug="karamazov"] .h1-work { font-family: "Old Standard TT", Georgia, serif; font-style: normal; }
.hero__sub .amp { color: var(--spruce); font-style: italic; }
.hero__sub { font-size: var(--t-md); line-height: 1.5; color: var(--ink-soft); margin-bottom: 2rem; max-width: 30rem; }
.hero__sub b { color: var(--ink); font-weight: 400; }
.hero__cta { margin-bottom: 2.1rem; }
.hero__langs {
  display: flex; flex-wrap: wrap; gap: .55rem 0; align-items: center;
  font-size: var(--t-small); color: var(--sepia); letter-spacing: .04em;
  border-top: 1px solid var(--hairline); padding-top: 1.1rem;
}
.hero__langs button { white-space: nowrap; font: inherit; color: var(--sepia); background: none; border: 0; padding: .2rem 0; cursor: pointer; transition: color .2s ease; text-underline-offset: 3px; }
.hero__langs button:hover, .hero__langs button:focus-visible { color: var(--spruce); text-decoration: underline; }
.hero__langs button::after { content: "·"; display: inline-block; padding: 0 .65rem; color: var(--hairline-bold); }
.hero__langs button:last-child::after { content: ""; padding: 0; }

.hero__stage { display: flex; flex-direction: column; align-items: center; gap: 1.3rem; }

/* ---- Library (six plates) ---------------------------------------------- */
.library__grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--hairline); border: 1px solid var(--hairline);
}
.plate {
  position: relative; display: flex; flex-direction: column; gap: .9rem;
  background: var(--paper); padding: clamp(1.5rem, 2.4vw, 2.1rem);
  min-height: 17rem; transition: background-color .35s ease, transform .35s ease;
  isolation: isolate;
}
.plate:hover { background: var(--paper-raised); }
.plate__top { display: flex; align-items: center; justify-content: space-between; }
.plate__lang { font-size: var(--t-label); letter-spacing: .2em; text-transform: uppercase; color: var(--sepia); }
.plate__name { font-size: 2rem; line-height: 1; color: var(--ink); }
.plate__work { font-style: italic; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.3; }
.plate__author { font-size: var(--t-small); color: var(--sepia); }
.plate__concept { font-size: .92rem; color: var(--ink-soft); line-height: 1.5; margin-top: auto; }
.plate__go {
  display: inline-flex; align-items: center; gap: .45rem; margin-top: .4rem;
  font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
}
.plate__go .arr { transition: transform .25s ease; }
.plate:hover .plate__go .arr { transform: translateX(4px); }
.plate__accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform .35s ease; }
.plate:hover .plate__accent { transform: scaleY(1); }
/* night mode: each book glows with its luminous night accent, not the dark day one */
html[data-theme="night"] .plate__accent { background: var(--accent-night, var(--accent)); }

/* ---- Method ------------------------------------------------------------- */
.method__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.facet { background: var(--paper); padding: clamp(1.6rem, 3vw, 2.6rem); display: flex; flex-direction: column; gap: .7rem; }
.facet__mark { color: var(--spruce); width: 30px; height: 30px; }
.facet h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--t-lg); line-height: 1.1; }
.facet p { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.55; }
.facet p b { color: var(--ink); font-weight: 400; }

/* ---- Colophon / provenance --------------------------------------------- */
.colophon { background: var(--paper-sunk); border-block: 1px solid var(--hairline); }
.colophon__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.ledger { display: grid; gap: 0; border-top: 1px solid var(--hairline-bold); }
.ledger__row { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--hairline); align-items: baseline; }
.ledger__row dt { font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--sepia); }
.ledger__row dd { font-size: .98rem; color: var(--ink); }
.ledger__row dd em { font-style: italic; }
.ledger__row small { color: var(--ink-soft); }

/* ---- Footer ------------------------------------------------------------- */
.footer { padding-block: clamp(3rem, 6vw, 5rem); }
.footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; align-items: flex-start; }
.footer__brand .word { font-family: var(--font-display); font-size: 1.5rem; }
.footer__brand .word span { font-size: .58em; letter-spacing: .34em; color: var(--sepia); text-transform: uppercase; padding-left: .4em; }
.footer__cols { display: flex; gap: clamp(2rem, 6vw, 5rem); flex-wrap: wrap; }
.footer__col h2 { font-size: var(--t-label); letter-spacing: .18em; text-transform: uppercase; color: var(--sepia); margin-bottom: .9rem; font-weight: 400; }
.footer__col a { display: block; padding: .28rem 0; color: var(--ink-soft); font-size: .96rem; transition: color .2s ease; }
.footer__col a:hover { color: var(--ink); }
.footer__rule { margin-block: clamp(2rem, 4vw, 3rem); }
.footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; font-size: var(--t-small); color: var(--sepia); }

/* ---- Reveal-on-load / scroll ------------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
}

/* ---- Easter-egg crumb toast -------------------------------------------- */
.crumb {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translate(-50%, 1.5rem);
  background: var(--ink); color: var(--paper);
  font-size: var(--t-small); padding: .7rem 1.1rem; border-radius: 100px;
  box-shadow: 0 12px 30px var(--shadow-deep); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .4s ease, transform .4s ease;
}
.crumb.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .crumb { transition: opacity .2s ease; } }

/* ---- App-page extras --------------------------------------------------- */
.backlink { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 1.6rem; transition: gap .25s, color .25s; }
.backlink:hover { color: var(--ink); gap: .8rem; }
.apphero__sub { font-style: italic; color: var(--ink-soft); font-size: var(--t-md); margin-bottom: 1.1rem; }
.apphero__sub b { font-style: normal; color: var(--ink); font-weight: 400; }

.morestrip { display: flex; flex-wrap: wrap; gap: .6rem; }
.morestrip a { display: inline-flex; flex-direction: column; padding: .7rem 1rem; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--paper-raised); transition: border-color .25s, transform .2s; }
.morestrip a:hover { border-color: var(--hairline-bold); transform: translateY(-2px); }
.morestrip a b { font-family: var(--font-display); font-weight: 400; font-size: 1.05rem; }
.morestrip a span { font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; color: var(--sepia); }

/* the critical note (Bloom-register summary) on each app page */
.essay { max-width: 40rem; margin-inline: auto; }
.essay__orn { text-align: center; color: var(--spruce); font-size: 1.25rem; margin-bottom: 1.3rem; opacity: .9; }
.essay__body { font-family: var(--font-text); font-size: var(--t-md); line-height: 1.75; color: var(--ink); }
.essay__body::first-letter { font-family: var(--font-display); font-size: 3.1em; line-height: .8; float: left; padding: .04em .12em 0 0; color: var(--spruce); }

/* ---- Responsive : tablet ----------------------------------------------- */
@media (max-width: 920px) {
  .hero__grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero__copy { max-width: 38rem; margin-inline: auto; text-align: center; }
  .hero__cta .btn-row { justify-content: center; }
  .hero__langs { justify-content: center; }
  .library__grid { grid-template-columns: repeat(2, 1fr); }
  .colophon__grid { grid-template-columns: 1fr; }
}

/* ---- Responsive : phone ------------------------------------------------- */
@media (max-width: 600px) {
  .nav-hide-sm { display: none; }
  .method__grid { grid-template-columns: 1fr; }
  .library__grid { grid-template-columns: 1fr; }
  .plate { min-height: auto; }
  .footer__top { flex-direction: column; }
}
