/* France Chess — Blog shared stylesheet */

/* Self-hosted Outfit — two subsets cover all FR characters */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --bg: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-nav: rgba(241, 245, 249, 0.85);
  --accent: #2563eb;
  --text: #334155;
  --text-muted: #64748b;
  --border: rgba(51, 65, 85, 0.08);
  --border-nav: rgba(51, 65, 85, 0.12);
  color-scheme: light;
}

/* OS preference — fallback when no manual override */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --bg-card: rgba(15, 23, 42, 0.55);
    --bg-nav: rgba(11, 17, 32, 0.85);
    --accent: #60a5fa;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.07);
    --border-nav: rgba(255, 255, 255, 0.1);
    color-scheme: dark;
  }
}

/* Manual dark toggle — same localStorage key as the app ('theme') */
html.dark {
  --bg: #0b1120;
  --bg-card: rgba(15, 23, 42, 0.55);
  --bg-nav: rgba(11, 17, 32, 0.85);
  --accent: #60a5fa;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.07);
  --border-nav: rgba(255, 255, 255, 0.1);
  color-scheme: dark;
}

/* Manual light toggle — overrides OS dark preference */
html.light {
  --bg: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-nav: rgba(241, 245, 249, 0.85);
  --accent: #2563eb;
  --text: #334155;
  --text-muted: #64748b;
  --border: rgba(51, 65, 85, 0.08);
  --border-nav: rgba(51, 65, 85, 0.12);
  color-scheme: light;
}

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(14, 165, 233, 0.04) 0%, transparent 40%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Glass utility ──────────────────────────────────────────────────────── */

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: .875rem;
}

/* ─── Floating navbar ────────────────────────────────────────────────────── */

.nav-wrap {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding-top: 1.25rem;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.nav-pill {
  width: calc(100% - 2rem);
  max-width: 960px;
  background: var(--bg-nav);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-nav);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 56px;
  pointer-events: all;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: .625rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-name {
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: -.04em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: .25rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  padding: .375rem .625rem;
  border-radius: .5rem;
  transition: background .15s, color .15s;
}

.nav-links a:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--text);
  text-decoration: none;
}

.nav-links a[aria-current] {
  color: var(--accent);
  background: rgba(37, 99, 235, .08);
}

/* ─── Mobile hamburger button ────────────────────────────────────────────── */

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .625rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: .5rem;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  line-height: 0;
}

.menu-toggle svg { pointer-events: none; }

.menu-toggle:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--text);
}

/* ─── Mobile dropdown menu ───────────────────────────────────────────────── */

.nav-mobile {
  display: none;
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  background: var(--bg-nav);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-nav);
  padding: .5rem 1rem 1rem;
  flex-direction: column;
  gap: .125rem;
  z-index: 99;
}

.nav-mobile.open { display: flex; }

.nav-mobile a {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9375rem;
  font-weight: 500;
  padding: .625rem .75rem;
  border-radius: .5rem;
  transition: background .15s, color .15s;
}

.nav-mobile a:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--text);
  text-decoration: none;
}

.nav-mobile a[aria-current] {
  color: var(--accent);
  background: rgba(37, 99, 235, .08);
}

@media (max-width: 640px) {
  .nav-wrap { padding-top: 0; }
  .nav-pill {
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    padding: 0 1rem;
    height: 52px;
  }
  .nav-links { display: none; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .brand-name { display: none; }
  .brand-logo { width: 30px; height: 30px; }
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.page-top { height: 5.5rem; }

@media (max-width: 640px) {
  .page-top { height: 4rem; }
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ─── Breadcrumb ─────────────────────────────────────────────────────────── */

.bc {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
}

.bc a { color: var(--text-muted); text-decoration: none; }
.bc a:hover { color: var(--accent); }

/* ─── Typography ─────────────────────────────────────────────────────────── */

h1 {
  font-weight: 800;
  letter-spacing: -.02em;
  font-size: clamp(1.75rem, 4vw, 2.375rem);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-weight: 700;
  letter-spacing: -.01em;
  font-size: 1.25rem;
  margin: 2.25rem 0 .75rem;
  line-height: 1.3;
}

p { margin-bottom: 1rem; }
ul, ol { margin: 0 0 1rem 1.25rem; }
li { margin-bottom: .375rem; }
strong { font-weight: 600; }
a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* ─── CTA box ────────────────────────────────────────────────────────────── */

.cta { padding: 1.5rem; margin: 2.5rem 0; }
.cta a { font-weight: 600; }

/* ─── Related links ──────────────────────────────────────────────────────── */

.also {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.also h3 {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.chips a {
  display: inline-flex;
  align-items: center;
  padding: .4rem .875rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: .5rem;
  font-size: .875rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}

.chips a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: .8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ─── Article: Elo formula ───────────────────────────────────────────────── */

.formula {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: 1rem 1.25rem;
  font-family: monospace;
  font-size: .9375rem;
  margin: 1rem 0;
  overflow-x: auto;
}

/* ─── Article: Cadence cards ─────────────────────────────────────────────── */

.cadence-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (max-width: 560px) {
  .cadence-grid { grid-template-columns: 1fr; }
}

.cadence-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 1rem 1.25rem;
}

.cadence-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.cadence-card p { font-size: .875rem; color: var(--text-muted); margin: 0; }

/* ─── Article: Numbered steps ────────────────────────────────────────────── */

.steps { counter-reset: step; list-style: none; margin-left: 0; padding-left: 0; }

.steps li {
  counter-increment: step;
  padding: .75rem 1rem .75rem 3rem;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: .5rem;
  margin-bottom: .5rem;
  position: relative;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: .75rem;
  top: .875rem;
  background: var(--accent);
  color: #fff;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}

/* ─── Article: FIDE titles table ─────────────────────────────────────────── */

.title-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: .9rem;
  overflow-x: auto;
  display: block;
}

.title-table th {
  background: var(--bg-card);
  padding: .625rem .875rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.title-table td { padding: .5rem .875rem; border-bottom: 1px solid var(--border); }
.title-table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: .25rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.badge-gm { background: #fef3c7; color: #92400e; }
.badge-im { background: #dbeafe; color: #1e40af; }
.badge-fm { background: #d1fae5; color: #065f46; }
.badge-cm { background: #f3f4f6; color: #374151; }

@media (prefers-color-scheme: dark) {
  .badge-gm { background: #422006; color: #fbbf24; }
  .badge-im { background: #1e3a5f; color: #93c5fd; }
  .badge-fm { background: #052e16; color: #6ee7b7; }
  .badge-cm { background: #1f2937; color: #9ca3af; }
}

html.dark .badge-gm { background: #422006; color: #fbbf24; }
html.dark .badge-im { background: #1e3a5f; color: #93c5fd; }
html.dark .badge-fm { background: #052e16; color: #6ee7b7; }
html.dark .badge-cm { background: #1f2937; color: #9ca3af; }
html.light .badge-gm { background: #fef3c7; color: #92400e; }
html.light .badge-im { background: #dbeafe; color: #1e40af; }
html.light .badge-fm { background: #d1fae5; color: #065f46; }
html.light .badge-cm { background: #f3f4f6; color: #374151; }

/* ─── Article: Event list ────────────────────────────────────────────────── */

.event-list { list-style: none; margin-left: 0; padding: 0; }

.event-list li {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: .875rem 0;
  border-bottom: 1px solid var(--border);
}

.event-list li:last-child { border-bottom: none; }

.event-dot {
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: .375rem;
}

/* ─── Blog index: page header ────────────────────────────────────────────── */

.page-header { margin-bottom: 3rem; }

.page-header h1 { font-size: clamp(1.875rem, 5vw, 2.75rem); }

.subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
  margin-top: .5rem;
}

/* ─── Blog index: article cards ──────────────────────────────────────────── */

.articles { display: grid; gap: 1rem; }

.article-card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

.article-card:hover {
  border-color: rgba(37, 99, 235, .3);
  box-shadow: 0 4px 20px rgba(37, 99, 235, .08);
  text-decoration: none;
}

.article-tag {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.article-title { font-size: 1.125rem; font-weight: 700; line-height: 1.35; }
.article-desc { font-size: .9rem; color: var(--text-muted); line-height: 1.55; }

.article-arrow {
  font-size: .875rem;
  color: var(--accent);
  font-weight: 600;
  align-self: flex-start;
  margin-top: .25rem;
}

/* ─── Blog index: app links ──────────────────────────────────────────────── */

.section-label {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 2.5rem 0 1rem;
}

.app-links { display: flex; flex-wrap: wrap; gap: .75rem; }

.app-link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: border-color .15s, color .15s;
}

.app-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ─── Theme toggle button ────────────────────────────────────────────────── */

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .375rem;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  line-height: 0;
}

.theme-toggle:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--text);
}

/* Moon shown in light mode, hidden in dark */
.icon-sun  { display: none; }
.icon-moon { display: block; }

html.dark .icon-sun  { display: block; }
html.dark .icon-moon { display: none; }

/* When OS is dark but no manual class yet */
@media (prefers-color-scheme: dark) {
  html:not(.light) .icon-sun  { display: block; }
  html:not(.light) .icon-moon { display: none; }
}
