/* ============================================================================
   FutureCraft Guide - guide.digitalhousingcommons.org
   Brand: Exo 2, white surface, #ef4444 -> #1800ad gradient (accent only).
   This is a single-document multilingual publication. One template, one page
   per language, prominent language picker, downloadable PDF.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-tint: #f7f5fa;
  --bg-deep: #f0edf5;
  --line: #e5e0ec;
  --line-soft: #ece8f1;
  --ink: #1a1426;
  --ink-mid: #4a4360;
  --ink-soft: #6e6582;
  --ink-faint: #9690a8;
  --red: #ef4444;
  --purple: #1800ad;
  --purple-bright: #7c3aed;
  --grad: linear-gradient(135deg, #ef4444 0%, #1800ad 100%);
  --grad-h: linear-gradient(90deg, #ef4444 0%, #1800ad 100%);

  --measure: 720px;
  --measure-wide: 980px;

  --font-display: 'Exo 2', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--ink);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--red); color: #fff; }
a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- per-script font fallbacks ----
   Exo 2 only covers Latin and Cyrillic well. For scripts it does not cover,
   stack a matching Noto Sans family in front so the page does not fall back
   to system defaults that break the visual register. */
body.lang-ar, body.lang-fa { font-family: 'Noto Sans Arabic', var(--font-display); }
body.lang-zh { font-family: 'Noto Sans SC', var(--font-display); }
body.lang-ja { font-family: 'Noto Sans JP', var(--font-display); }
body.lang-ko { font-family: 'Noto Sans KR', var(--font-display); }
body.lang-mr, body.lang-ne { font-family: 'Noto Sans Devanagari', var(--font-display); }
body.lang-ta { font-family: 'Noto Sans Tamil', var(--font-display); }
body.lang-km { font-family: 'Noto Sans Khmer', var(--font-display); }
body.lang-lo { font-family: 'Noto Sans Lao', var(--font-display); }

/* ============ NAV ============ */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.88);
  border-bottom: 1px solid var(--line);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.nav-brand img { height: 30px; width: auto; display: block; }
.nav-brand-text {
  font-family: var(--font-display);  /* always Latin for the wordmark */
  font-size: 11px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-mid);
}
.nav-brand-text .slash { color: var(--ink-faint); margin: 0 6px; }
.nav-brand-text .guide { color: var(--ink); }

.nav-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Language picker. Custom-styled native select for accessibility. */
.lang-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.lang-picker select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 32px 8px 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  max-width: 240px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.lang-picker select:hover { border-color: var(--purple-bright); }
.lang-picker select:focus {
  outline: 0;
  border-color: var(--red);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.10);
}
.lang-picker-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
  display: flex;
}
[dir="rtl"] .lang-picker select { padding: 8px 14px 8px 32px; }
[dir="rtl"] .lang-picker-icon { right: auto; left: 12px; }

.nav-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--red);
  border-radius: 3px;
  text-decoration: none;
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}
.nav-pdf:hover { background: var(--red); color: #fff; }
.nav-pdf .pdf-tag {
  font-size: 9px;
  letter-spacing: 0.18em;
  padding: 2px 5px;
  background: var(--red);
  color: #fff;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s;
}
.nav-pdf:hover .pdf-tag { background: #fff; color: var(--red); }

@media (max-width: 720px) {
  nav.site-nav { padding: 12px 18px; gap: 12px; flex-wrap: wrap; }
  .nav-brand-text { font-size: 10px; }
  .nav-tools { gap: 8px; }
  .nav-pdf .pdf-label { display: none; }
  .nav-pdf { padding: 8px 10px; }
  .lang-picker select { max-width: 180px; font-size: 11px; padding: 7px 28px 7px 12px; }
}

/* ============ MAIN LAYOUT ============ */
.guide-main {
  padding: 64px 32px 96px;
  display: flex;
  justify-content: center;
}
.guide-article {
  width: 100%;
  max-width: var(--measure);
}
@media (max-width: 720px) {
  .guide-main { padding: 40px 22px 64px; }
}

/* ============ PROSE - the actual document ============ */
.prose { color: var(--ink-mid); }
.prose > * + * { margin-top: 22px; }

/* h1 - document title. Style follows the DHC hero h1.
   The English source uses "# FutureCraft" followed by "*A short guide.*" so
   the H1 is short and the italicised subtitle sits in its own paragraph. */
.prose h1 {
  font-size: clamp(40px, 6.5vw, 64px);
  font-weight: 200;
  line-height: 1.06;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin-bottom: 8px;
  margin-top: 0;
  position: relative;
  padding-top: 28px;
}
.prose h1::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 64px; height: 2px;
  background: var(--grad-h);
}
[dir="rtl"] .prose h1::before { left: auto; right: 0; }

/* The subtitle - an italic <em> wrapped in a <p> right after h1. */
.prose h1 + p {
  font-size: 19px;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 48px;
}

/* h2 - section headings. Each one gets a small gradient mark above. */
.prose h2 {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 200;
  line-height: 1.2;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-top: 64px;
  margin-bottom: 20px;
  padding-top: 18px;
  position: relative;
}
.prose h2::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 1px;
  background: var(--grad-h);
}
[dir="rtl"] .prose h2::before { left: auto; right: 0; }
.prose h2 em {
  font-style: italic;
  font-weight: 300;
  background: var(--grad-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.prose h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--ink);
  margin-top: 36px;
  margin-bottom: 12px;
}

/* Body paragraphs. */
.prose p {
  line-height: 1.72;
  font-weight: 300;
  color: var(--ink-mid);
}
.prose p strong { color: var(--ink); font-weight: 500; }
.prose p em { font-style: italic; color: var(--ink-mid); }

.prose a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s, color 0.2s;
}
.prose a:hover { border-bottom-color: var(--red); color: var(--red); }

.prose ul, .prose ol {
  padding-left: 22px;
  font-weight: 300;
  line-height: 1.7;
}
[dir="rtl"] .prose ul, [dir="rtl"] .prose ol { padding-left: 0; padding-right: 22px; }
.prose ul li, .prose ol li { margin-bottom: 8px; }
.prose ul li::marker { color: var(--purple-bright); }

/* The "Think about it." callouts - blockquotes in the markdown.
   The English source uses:
       > **Think about it.** ...
   So inside the blockquote there is a leading strong followed by prose.
   We treat the blockquote as a tinted card with a gradient mark and
   render the leading strong as a small-caps label. */
.prose blockquote {
  margin: 32px 0;
  padding: 24px 28px;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-left: 2px solid var(--purple-bright);
  border-radius: 3px;
  position: relative;
}
[dir="rtl"] .prose blockquote {
  border-left: 1px solid var(--line);
  border-right: 2px solid var(--purple-bright);
}
.prose blockquote::before {
  content: '';
  position: absolute;
  top: -1px; left: 24px;
  width: 40px; height: 2px;
  background: var(--grad-h);
}
[dir="rtl"] .prose blockquote::before { left: auto; right: 24px; }
.prose blockquote p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  font-weight: 300;
  margin: 0;
}
.prose blockquote p + p { margin-top: 14px; }
.prose blockquote strong:first-child {
  display: inline;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-right: 10px;
}
[dir="rtl"] .prose blockquote strong:first-child {
  margin-right: 0;
  margin-left: 10px;
  letter-spacing: 0;
}

.prose hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 56px 0;
}

/* The closing signature block in the English source is a series of
   underscored lines like:
       Name: _________________________________________________
   That renders as plain paragraphs with underscores. We tighten the
   spacing so it reads as a form rather than as body prose. */
.prose p:has(+ p:first-letter) { } /* no-op, kept for future selector additions */

/* The Declaration pillars at the end use "**01** Inclusive, ..." style.
   These paragraphs have a strong number at the start - we give them a
   numbered-list visual. */
.prose p > strong:first-child:only-of-type {
  /* Subtle: only when the strong is the first thing in the paragraph and
     looks like a number marker. JavaScript would do this more cleanly
     but the styling here is gentle so safe to apply broadly. */
}

/* ============ FOOTER ============ */
footer.site-footer {
  padding: 56px 0 36px;
  border-top: 1px solid var(--line);
  position: relative;
  margin-top: 96px;
}
footer.site-footer::before {
  content: '';
  position: absolute;
  top: -1px; left: 32px;
  width: 64px; height: 1px;
  background: var(--grad-h);
}
[dir="rtl"] footer.site-footer::before { left: auto; right: 32px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 32px; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-col h4 {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 14px;
}
.footer-col p,
.footer-col a {
  font-size: 13px;
  color: var(--ink-mid);
  text-decoration: none;
  line-height: 1.8;
  font-weight: 300;
  display: block;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--ink); }
.footer-brand img { height: 40px; margin-bottom: 14px; }
.footer-brand p { font-size: 12px; color: var(--ink-faint); max-width: 360px; line-height: 1.55; }
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-lang .sep { color: var(--line); margin: 0 8px; }

@media (max-width: 720px) {
  footer.site-footer { padding: 40px 0 28px; }
  footer.site-footer::before { left: 18px; }
  .wrap { padding: 0 22px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* ============ LANGUAGE HINT BANNER ============ */
/* Shown once on the English page if the browser prefers another language
   we serve. Dismissable, remembered in localStorage. */
.lang-hint {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  z-index: 999;
  max-width: calc(100vw - 32px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.lang-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.lang-hint.dismissed { opacity: 0; }
.lang-hint-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 18px;
  background: var(--ink);
  color: #fff;
  border-radius: 3px;
  box-shadow: 0 8px 32px rgba(26,20,38,0.18);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.4;
}
.lang-hint-text a {
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.35);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 1px;
  transition: border-color 0.2s;
}
.lang-hint-text a:hover { border-bottom-color: #fff; }
.lang-hint-dismiss {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.7);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}
.lang-hint-dismiss:hover { color: #fff; }

/* ============ PRINT ============ */
@media print {
  nav.site-nav, footer.site-footer { display: none; }
  .guide-main { padding: 0; }
  body { font-size: 11pt; line-height: 1.5; }
  .prose h1 { font-size: 32pt; }
  .prose h2 { font-size: 18pt; page-break-after: avoid; }
  .prose blockquote { page-break-inside: avoid; }
  a { color: inherit; border: 0; }
}
