/* ─────────────────────────────────────────────────────────────
   FiRent — Design tokens
   Palette: cream + terracotta + ochre + olive + ink
   Type: Fraunces (display) + Hanken Grotesk (sans) + JetBrains Mono
   ───────────────────────────────────────────────────────────── */

:root {
  /* ── Palette: cream-warm (default) ─────────────────────────── */
  --bg:           #faf4e8;
  --bg-deep:      #f3ead7;
  --paper:        #fdf9f0;
  --paper-warm:   #f7eedb;
  --ink:          #1f1a16;
  --ink-soft:     #4a4036;
  --ink-muted:    #8a7e6f;
  --ink-faint:    #b3a795;
  --terracotta:   #d68762;
  --terracotta-d: #b86a48;
  --ochre:        #e6b878;
  --olive:        #8a9472;
  --olive-d:      #6b755a;
  --line:         rgba(31, 26, 22, 0.12);
  --line-soft:    rgba(31, 26, 22, 0.06);

  /* ── Type ───────────────────────────────────────────────────── */
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans:  "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Type scale — fluid */
  --t-display-xl: clamp(4rem, 11vw, 11rem);
  --t-display-l:  clamp(3.25rem, 8vw, 7rem);
  --t-display-m:  clamp(2.5rem, 5vw, 4.5rem);
  --t-h1:         clamp(2.25rem, 4vw, 3.5rem);
  --t-h2:         clamp(1.75rem, 2.6vw, 2.5rem);
  --t-h3:         clamp(1.25rem, 1.6vw, 1.5rem);
  --t-body:       1.0625rem;
  --t-body-l:     1.25rem;
  --t-small:      0.9375rem;
  --t-caption:    0.75rem;
  --t-eyebrow:    0.6875rem;

  /* ── Spacing ──────────────────────────────────────────────── */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;
  --s-10: 128px;
  --s-11: 192px;

  --gutter: clamp(20px, 4vw, 56px);
  --max-w:  1440px;

  /* ── Radii / shadow ───────────────────────────────────────── */
  --r-sm: 2px;
  --r-md: 6px;
  --r-lg: 14px;
  --r-pill: 999px;

  --shadow-card: 0 1px 0 rgba(31,26,22,0.04), 0 18px 40px -24px rgba(31,26,22,0.18);
  --shadow-pop:  0 30px 80px -30px rgba(31,26,22,0.35);

  /* ── Motion ───────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0.05, 0.36, 1);
  --d-fast: 200ms;
  --d-med:  400ms;
  --d-slow: 800ms;
}

/* ── Palette variants ───────────────────────────────────────── */
[data-palette="warm"] { /* default — already set above */ }

[data-palette="ivory"] {
  --bg:           #f4ede0;
  --bg-deep:      #ebe1cd;
  --paper:        #f9f2e5;
  --paper-warm:   #f0e7d2;
  --terracotta:   #c97a4a;
  --terracotta-d: #a86238;
  --ochre:        #d9a85a;
  --olive:        #7a8260;
  --ink:          #1f1c18;
}

[data-palette="bone"] {
  --bg:           #efe6d3;
  --bg-deep:      #e4d9c0;
  --paper:        #f5edda;
  --paper-warm:   #ebe1ca;
  --terracotta:   #a85a3e;
  --terracotta-d: #8a4530;
  --ochre:        #c89058;
  --olive:        #606b4a;
  --ink:          #1a1714;
}

/* ── Base ───────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

body {
  overflow-x: hidden;
}

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

::selection {
  background: var(--terracotta);
  color: var(--paper);
}

/* ── Type utilities ─────────────────────────────────────────── */
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.sans  { font-family: var(--sans); }
.mono  { font-family: var(--mono); font-size: var(--t-caption); letter-spacing: 0.04em; text-transform: uppercase; }

.display-xl { font-family: var(--serif); font-size: var(--t-display-xl); font-weight: 350; line-height: 0.95; letter-spacing: -0.025em; }
.display-l  { font-family: var(--serif); font-size: var(--t-display-l);  font-weight: 350; line-height: 1.0;  letter-spacing: -0.02em; }
.display-m  { font-family: var(--serif); font-size: var(--t-display-m);  font-weight: 400; line-height: 1.05; letter-spacing: -0.018em; }
.h1         { font-family: var(--serif); font-size: var(--t-h1);         font-weight: 400; line-height: 1.08; letter-spacing: -0.015em; }
.h2         { font-family: var(--serif); font-size: var(--t-h2);         font-weight: 400; line-height: 1.15; letter-spacing: -0.01em; }
.h3         { font-family: var(--serif); font-size: var(--t-h3);         font-weight: 400; line-height: 1.25; }
.italic     { font-style: italic; }
.body       { font-family: var(--sans); font-size: var(--t-body); line-height: 1.55; color: var(--ink-soft); }
.body-l     { font-family: var(--sans); font-size: var(--t-body-l); line-height: 1.5; color: var(--ink-soft); }
.small      { font-family: var(--sans); font-size: var(--t-small); line-height: 1.45; }
.eyebrow    { font-family: var(--mono); font-size: var(--t-eyebrow); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-muted); }

/* ── Containers ────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.container-wide {
  max-width: 1680px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform var(--d-fast) var(--ease-out), background var(--d-fast), color var(--d-fast);
  white-space: nowrap;
}
.btn { transform: translate(var(--mx, 0px), var(--my, 0px)); }
.btn:active { transform: translate(var(--mx, 0px), var(--my, 0px)) scale(0.97); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--terracotta-d); }

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn-link {
  padding: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  gap: 6px;
}
.btn-link:hover { color: var(--terracotta-d); border-color: var(--terracotta-d); }

.btn-arrow::after {
  content: "→";
  font-family: var(--serif);
  transition: transform var(--d-fast) var(--ease-out);
}
.btn-arrow:hover::after { transform: translateX(4px); }

/* ── Tags / pills ──────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  background: var(--paper);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--olive);
  display: inline-block;
}

/* ── Editorial rule (number + label) ───────────────────────── */
.section-rule {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-7);
}
.section-rule .num {
  font-family: var(--mono);
  font-size: var(--t-caption);
  color: var(--ink-muted);
  letter-spacing: 0.16em;
}
.section-rule .label {
  font-family: var(--mono);
  font-size: var(--t-caption);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ── Placeholder (striped) ─────────────────────────────────── */
.placeholder {
  position: relative;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(31,26,22,0.045) 0 1px,
      transparent 1px 14px
    ),
    var(--paper-warm);
  border: 1px solid var(--line);
  overflow: hidden;
  color: var(--ink-muted);
}
.placeholder .ph-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
}
.placeholder .ph-label::before {
  content: "▢";
  margin-right: 8px;
  opacity: 0.5;
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Focus ─────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--terracotta-d);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── CJK (中文) ─────────────────────────────────────────────
   I font self-hosted (Fraunces / Hanken Grotesk / JetBrains Mono)
   coprono solo il latino: per il cinese si ricade sui font di
   sistema, e si azzerano crenature e corsivi sintetici — che sui
   caratteri han risultano sempre di qualità scadente. */
html[lang^="zh"] {
  --serif: "Fraunces", "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans:  "Hanken Grotesk", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Hiragino Sans GB", sans-serif;
  --mono:  "JetBrains Mono", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", ui-monospace, monospace;
}
html[lang^="zh"] .display-xl,
html[lang^="zh"] .display-l,
html[lang^="zh"] .display-m,
html[lang^="zh"] .h1,
html[lang^="zh"] .h2,
html[lang^="zh"] .serif { letter-spacing: 0; }
html[lang^="zh"] .display-xl,
html[lang^="zh"] .display-l { line-height: 1.14; }
/* Titoli con interlinea stretta di progetto: rilassata per gli han */
html[lang^="zh"] .hero__title,
html[lang^="zh"] .cta-final__title,
html[lang^="zh"] .pearl-hero__name,
html[lang^="zh"] .pearl-next__name,
html[lang^="zh"] .footer__tag,
html[lang^="zh"] .plist__name { line-height: 1.18; }
html[lang^="zh"] .display-m { line-height: 1.2; }
html[lang^="zh"] .h1,
html[lang^="zh"] .h2 { line-height: 1.35; }
html[lang^="zh"] .body,
html[lang^="zh"] .body-l { line-height: 1.75; }
html[lang^="zh"] .mono { letter-spacing: 0.06em; }
html[lang^="zh"] .eyebrow { letter-spacing: 0.1em; }
html[lang^="zh"] .italic,
html[lang^="zh"] .serif.italic { font-style: normal; font-synthesis: none; }
