/* Inter, ospitato qui invece che su Google Fonts.
 *
 * Il collegamento a fonts.googleapis.com faceva contattare i server di
 * Google dal browser di ogni visitatore, trasmettendogli l'indirizzo IP
 * senza che nessuno avesse acconsentito. Un solo file variabile copre tutti
 * i pesi da 100 a 900: meno richieste di prima, e nessuna verso terzi.
 *
 * Inter, SIL Open Font License 1.1 — fonts/OFL.txt
 */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-latin-variable.woff2') format('woff2');
}

/* LDF Interactive, shared styles.
 *
 * These are the STUDIO defaults. Any single app page can wear its own
 * colours by redefining the two accent variables in a <style> block in
 * its <head>, after this stylesheet is linked:
 *
 *     <style>
 *       :root { --accent: #4C8DFF; --gold: #3DD68C; }
 *     </style>
 *
 * Everything downstream follows automatically: buttons, badges, labels,
 * card hovers, tags. Keep the studio pages (home, apps, support,
 * privacy) on the defaults so the shell stays recognisably ours.
 */

:root {
  /* Neutrals are deliberately cool. The old warm greys read as parchment,
     which suited Grimoire but made the studio look like a fantasy brand. */
  --bg: #0B0C0F;
  --bg-card: #14161A;
  --bg-hover: #1C1F26;
  --text: #E9EBEE;
  --text-secondary: #8B929C;
  --text-faint: #5C636E;

  --accent: #D14232;
  --accent-dim: rgba(209, 66, 50, 0.14);
  --gold: #C9A24B;

  --border: #22262E;
  --border-strong: #2E343E;
  --danger: #E5484D;
  --success: #3DD68C;

  --radius: 14px;
  --radius-sm: 9px;
  --max-w: 880px;

  /* One vertical rhythm for the whole site, so spacing stops being ad hoc. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 72px;
  --s9: 104px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  font-feature-settings: 'kern' 1, 'liga' 1, 'cv11' 1;
}

/* Headings get tighter tracking and leading than body text. Left at default
   they read soft and undesigned, which was most of what felt unfinished. */
h1, h2, h3 { letter-spacing: -0.021em; line-height: 1.15; }

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: var(--accent); }

/* Underlines belong on links inside prose, not on navigation or controls. */
.nav a, .footer-links a, .btn, .app-entry, .nav-brand { text-decoration: none; }

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

/* Inline SVG icons replace the emoji that were standing in for them. */
.icon { width: 22px; height: 22px; display: block; stroke-width: 1.6; }
.icon-lg { width: 26px; height: 26px; }

.icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s4);
}

/* Support cards are centred, so their badge has to be too. */
.icon-badge-center { margin-left: auto; margin-right: auto; }
.icon-badge-lg { width: 56px; height: 56px; border-radius: 14px; margin-bottom: var(--s5); }

/* ── Layout ── */

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

.section {
  padding: var(--s8) 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

/* ── Nav ── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 12, 15, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
}

.nav-brand .logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  opacity: 1;
}

/* ── Hero ── */

.hero {
  padding: var(--s9) 0 var(--s8);
  text-align: center;
}

/* Filled pill rather than outlined: the outline read as a stray border. */
.hero-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  padding: var(--s2) var(--s4);
  margin-bottom: var(--s5);
}

.hero h1 {
  font-size: clamp(38px, 6.5vw, 60px);
  font-weight: 800;
  line-height: 1.08;
  margin-bottom: var(--s5);
  letter-spacing: -0.028em;
}

.hero h1 .accent { color: var(--accent); }
.hero h1 .gold   { color: var(--gold); }

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 30rem;          /* a readable measure, not an arbitrary pixel width */
  margin: 0 auto var(--s7);
  line-height: 1.7;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 650;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

/* No scale on hover: it made every button feel like a toy. */
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #E04B3A; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--bg-hover); border-color: var(--text-faint); }

.btn-gold { background: var(--gold); color: #14161A; }
.btn-gold:hover { background: #D8B058; }

.btn-group {
  display: flex;
  gap: var(--s3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Cards ── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s5);
  transition: border-color 0.2s, background 0.2s;
}

.card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

/* Kept for pages that still pass an emoji; new markup uses .icon-badge. */
.card-icon {
  font-size: 30px;
  line-height: 1;
  margin-bottom: var(--s4);
}

.card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: var(--s2);
}

.card p {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.65;
}

/* 240px keeps three across inside the 812px content width
   (3 x 240 + 2 x 20 gap = 760). At 260px they wrapped to 2 + 1. */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s3);
  margin-top: var(--s7);
}

/* ── Section header ── */

.section-header {
  text-align: center;
  margin-bottom: var(--s7);
}

.section-header .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
}

.section-header h2 {
  font-size: clamp(27px, 3.6vw, 36px);
  font-weight: 800;
  line-height: 1.15;
}

.section-header p {
  color: var(--text-secondary);
  max-width: 520px;
  margin: 12px auto 0;
  font-size: 16px;
}

/* ── Feature rows ── */

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 64px;
}

.feature-row:last-child { margin-bottom: 0; }

.feature-row.reverse { direction: rtl; }
.feature-row.reverse > * { direction: ltr; }

.feature-text .label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.feature-text h3 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
}

.feature-text p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.feature-visual {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(209, 66, 50, 0.07), transparent 62%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  color: var(--text-faint);
}

.feature-visual svg {
  width: 46%;
  height: auto;
  stroke-width: 1.1;
}

/* ── Footer ── */

.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copy {
  color: var(--text-secondary);
  font-size: 14px;
}

.footer-links {
  display: flex;
  /* Wraps because the list grows: six entries no longer fit a phone on one
     line, and an un-wrapping footer scrolls the whole page sideways. */
  flex-wrap: wrap;
  gap: 12px 24px;
  list-style: none;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.footer-links a:hover { color: var(--text); }

/* ── Support page ── */

.support-hero {
  padding: 100px 0 60px;
  text-align: center;
}

.support-hero .emoji { font-size: 64px; margin-bottom: 20px; }

/* 280px forces two columns in the 812px content width, so the four support
   cards land as a tidy 2x2 instead of 3 + 1 orphan. */
.support-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.support-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.support-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.support-card .emoji { font-size: 40px; margin-bottom: 16px; }

.support-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.support-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ── App list (apps index + home) ── */

.app-entry {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}

a.app-entry:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  opacity: 1;
}

.app-entry-icon {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  flex-shrink: 0;
}

.app-entry-icon-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  font-size: 32px;
}

.app-entry-ghost { border-style: dashed; }
.app-entry-ghost h3 { color: var(--text-secondary); }

.app-entry-body { flex: 1; }

.app-entry-body h3 {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 2px;
}

.app-entry-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.app-entry-body p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.app-entry-arrow {
  color: var(--text-secondary);
  font-size: 22px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .app-entry {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .app-entry-arrow { display: none; }
}

/* ── App page ── */

.app-hero {
  padding: 100px 0 80px;
}

.app-hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.app-hero-text h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}

.app-hero-text p {
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.app-mockup {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 20px;
  aspect-ratio: 9/16;
  max-width: 300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 4px 14px;
  letter-spacing: 0.5px;
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .hero { padding: 80px 0 60px; }
  .section { padding: 60px 0; }

  .feature-row,
  .feature-row.reverse {
    grid-template-columns: 1fr;
    direction: ltr;
    gap: 32px;
  }

  .app-hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .app-mockup { margin: 0 auto; }

  .btn-group { flex-direction: column; align-items: center; }

  .nav-links { gap: 20px; }
}

@media (max-width: 480px) {
  .nav-links { display: none; }
  .container { padding: 0 16px; }
  .card { padding: 24px 20px; }
  .footer .container { flex-direction: column; text-align: center; }
}

/* ── Blog ── */

/* The listing and the articles read best narrower than the studio pages:
   one column of text, measured in characters, not in pixels of screen. */
.post-container { max-width: 700px; }

.blog-hero .section-header { margin-bottom: var(--s6); }

.tag-list-center {
  justify-content: center;
  margin-bottom: var(--s6);
}
.tag-list a.tag { text-decoration: none; }
.tag-list a.tag:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  max-width: 700px;
  margin: 0 auto;
}

.post-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s5) var(--s6);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.post-card:hover { border-color: var(--border-strong); background: var(--bg-hover); }

.post-card h3 { font-size: 20px; font-weight: 700; margin-bottom: var(--s2); }
.post-card p { color: var(--text-secondary); font-size: 15px; }

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: var(--s3);
}
.post-card-meta .tag { padding: 2px 10px; font-size: 11px; }

.blog-feed {
  text-align: center;
  margin-top: var(--s7);
  font-size: 14px;
  color: var(--text-faint);
}

/* Article */

.post { padding-top: var(--s8); }

.post-header { margin-bottom: var(--s7); }

.post-header .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
}
.post-header .label a { color: inherit; text-decoration: none; }
.post-header .label a:hover { text-decoration: underline; }

.post-header h1 {
  font-size: clamp(30px, 4.4vw, 42px);
  font-weight: 800;
  margin-bottom: var(--s4);
}

.post-lede {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: var(--s4);
}

.post-meta { font-size: 14px; color: var(--text-faint); }
.post-meta span { margin: 0 var(--s2); }

.prose { font-size: 17px; line-height: 1.7; }
.prose > * + * { margin-top: var(--s4); }
.prose h2 { font-size: 24px; font-weight: 700; margin-top: var(--s7); }
.prose h3 { font-size: 19px; font-weight: 700; margin-top: var(--s6); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: var(--s2); }
.prose li > p + p { margin-top: var(--s2); }
.prose strong { font-weight: 700; color: var(--text); }
.prose em { font-style: italic; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: var(--s7) 0; }

.prose blockquote {
  border-left: 3px solid var(--gold);
  padding-left: var(--s4);
  color: var(--text-secondary);
}

.prose code {
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
}
.prose pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--s4) var(--s5);
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.6;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); }
.prose th { color: var(--text-secondary); font-weight: 600; }

.post-footer {
  margin-top: var(--s8);
  padding-top: var(--s5);
  border-top: 1px solid var(--border);
}
.post-back { font-weight: 600; text-decoration: none; color: var(--text-secondary); }
.post-back:hover { color: var(--text); }

/* Home: latest articles */
.home-posts .post-list { max-width: none; }
.home-posts-more { text-align: center; margin-top: var(--s5); }

@media (max-width: 480px) {
  .post-card { padding: var(--s4) var(--s4); }
  .prose { font-size: 16px; }
}

/* ── Advertising slots ──
   Sized to the standard units so the placeholder and the real ad take the
   same room. Gutters only exist where the article leaves the space: the text
   column is 700px, a skyscraper 160px, and neither is allowed to squeeze the
   other. Below 1200px the gutters are gone and phones never see them. */

.post-layout { position: relative; }

.ad-gutter { display: none; }

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot-placeholder {
  width: 100%;
  height: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot-skyscraper { width: 160px; height: 600px; }

/* Leaderboard: 728×90 where it fits, 320×100 on phones. */
.ad-slot-leaderboard { width: 100%; max-width: 728px; height: 90px; margin: var(--s8) auto 0; }
@media (max-width: 767px) {
  .ad-slot-leaderboard { max-width: 320px; height: 100px; }
}

@media (min-width: 1200px) {
  .ad-gutter {
    display: block;
    position: absolute;
    top: var(--s8);
    bottom: 0;
    width: 160px;
  }
  .ad-gutter .ad-slot { position: sticky; top: calc(64px + var(--s5)); }
  /* Centred on the empty space between the text column and the viewport edge. */
  .ad-gutter-left  { left:  calc((100% - 700px) / 4 - 80px); }
  .ad-gutter-right { right: calc((100% - 700px) / 4 - 80px); }
}

@media (min-width: 1500px) {
  .ad-gutter, .ad-slot-skyscraper { width: 300px; }
  .ad-gutter-left  { left:  calc((100% - 700px) / 4 - 150px); }
  .ad-gutter-right { right: calc((100% - 700px) / 4 - 150px); }
}
