/* =========================
   Fair Deal Policy — v0 Design System
   Document-first, calm, credible, copyable
   ========================= */

/* ---- Reset (minimal) ---- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  color: #0f172a;            /* slate-900 */
  background: #ffffff;
}

/* ---- Tokens ---- */
:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #475569;          /* slate-600 */
  --muted-2: #64748b;        /* slate-500 */
  --border: #e2e8f0;         /* slate-200 */
  --surface: #f8fafc;        /* slate-50 */
  --surface-2: #f1f5f9;      /* slate-100 */

  --accent: #2563eb;         /* blue-600 */
  --accent-2: #1d4ed8;       /* blue-700 */

  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);

  --maxw: 1040px;
  --content: 760px;

  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;
  --space-6: 34px;
  --space-7: 46px;
  --space-8: 64px;

  --fs-0: 14px;
  --fs-1: 16px;
  --fs-2: 18px;
  --fs-3: 22px;
  --fs-4: 28px;
  --fs-5: 36px;

  --lh-tight: 1.2;
  --lh-normal: 1.6;
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.content {
  max-width: var(--content);
}

/* ---- Links ---- */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---- Header / Nav ---- */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.brand small {
  color: var(--muted-2);
  font-weight: 500;
}

.navlinks {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.navlinks a {
  color: var(--muted);
  font-weight: 520;
  padding: 8px 10px;
  border-radius: 10px;
}
.navlinks a:hover {
  background: var(--surface);
  text-decoration: none;
  color: var(--fg);
}

.navlinks a[aria-current="page"] {
  color: var(--fg);
  background: var(--surface-2);
}

/* ---- Page ---- */
main { padding: var(--space-7) 0 var(--space-8); }

.kicker {
  font-size: var(--fs-0);
  color: var(--muted-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

h1, h2, h3 {
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
}
h1 {
  font-size: var(--fs-5);
  line-height: var(--lh-tight);
}
h2 {
  font-size: var(--fs-4);
  line-height: var(--lh-tight);
  margin-top: var(--space-7);
}
h3 {
  font-size: var(--fs-3);
  line-height: var(--lh-tight);
  margin-top: var(--space-6);
}

p {
  margin: 0 0 var(--space-4);
  font-size: var(--fs-2);
}

.lede {
  font-size: var(--fs-3);
  color: var(--fg);
}

.muted { color: var(--muted); }
.small { font-size: var(--fs-0); color: var(--muted); }

/* ---- Cards / Callouts ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}

.callout {
  border-left: 4px solid rgba(37, 99, 235, 0.35);
  background: var(--surface);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-7) 0;
}

/* ---- Lists ---- */
ul, ol {
  margin: 0 0 var(--space-5);
  padding-left: 1.2em;
}
li { margin: 0.3em 0; font-size: var(--fs-2); }

/* ---- Anchors / Section links ---- */
.toc {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.toc a { color: var(--muted); }
.toc a:hover { color: var(--fg); text-decoration: none; }

/* ---- Code / Copy blocks ---- */
pre, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
pre {
  background: #0b1220;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: var(--space-5);
  overflow-x: auto;
  border: 1px solid rgba(226, 232, 240, 0.12);
  margin: 0 0 var(--space-5);
  box-shadow: var(--shadow);
}
pre code { font-size: 15px; line-height: 1.55; }

.copyrow {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  margin: var(--space-4) 0 var(--space-2);
}
.copyrow .label { color: var(--muted-2); font-size: var(--fs-0); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(0.5px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: rgba(37, 99, 235, 0.35);
}
.btn-primary:hover { background: var(--accent-2); }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  color: var(--muted);
  background: #fff;
}
.footer-grid {
  display: grid;
  gap: var(--space-4);
}
.footer-links {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--fg); text-decoration: none; }

/* ---- Responsive ---- */
@media (max-width: 720px) {
  :root {
    --fs-2: 17px;
    --fs-3: 20px;
    --fs-4: 26px;
    --fs-5: 32px;
    --space-7: 40px;
    --space-8: 54px;
  }
  .navbar { align-items: flex-start; }
  .navlinks { justify-content: flex-start; }
}

/* Mobile navigation */
.nav-toggle{
  display:none;
  border:1px solid var(--border);
  background:var(--bg);
  border-radius:12px;
  padding:10px 12px;
  margin-left:auto;
  cursor:pointer;
}
.nav-toggle:focus{ outline: 3px solid rgba(47,118,246,.25); outline-offset: 2px; }
.nav-toggle-bar{
  display:block;
  width:20px;
  height:2px;
  background: var(--accent); /* FIX: visible on mobile */
  margin:4px 0;
  border-radius:2px;
}

/* Better mobile readability and spacing */
@media (max-width: 800px){
  .container{ padding-left: 18px; padding-right: 18px; }
  .navbar{ gap: 12px; align-items: center; }
  .nav-toggle{ display:block; }
  .navlinks{
    display:none;
    position:absolute;
    left: 12px;
    right: 12px;
    top: calc(100% + 10px);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,.10);
    flex-direction: column;
  }
  body.nav-open .navlinks{ display:flex; }
  .navlinks a{
    padding: 10px 12px;
    border-radius: 12px;
  }
  .navlinks a:hover{ background: rgba(0,0,0,.04); }
  .btnrow{ flex-wrap: wrap; }
  .btn{ padding: 10px 14px; }
  pre{ overflow-x: auto; -webkit-overflow-scrolling: touch; }
  code{ font-size: .95em; }
}


/* --- Nav: "More" dropdown (polished) --- */

/* Ensure nav row wraps nicely without ugly full-width items */
.navlinks{
  display:flex;
  align-items:center;
  gap:22px;
  flex-wrap:wrap;
}

/* Make <details> behave like a normal inline nav item */
.navlinks .nav-more{
  position:relative;
  display:inline-block;
  margin:0;
  padding:0;
  border:0;
}

/* Style the summary like your other nav links */
.navlinks .nav-more > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  padding:6px 10px;
  border-radius:10px;
  font-weight:600;
  color:inherit;
  outline:none;
}

/* Remove default marker */
.navlinks .nav-more > summary::-webkit-details-marker{ display:none; }

/* Add a subtle chevron */
.navlinks .nav-more > summary::after{
  content:"▾";
  font-size:.9em;
  margin-left:8px;
  opacity:.7;
}

/* Hover states aligned with typical nav link hover */
.navlinks .nav-more > summary:hover{
  background:rgba(15, 23, 42, 0.06);
}

/* Open state */
.navlinks .nav-more[open] > summary{
  background:rgba(15, 23, 42, 0.08);
}

/* The dropdown panel */
.navlinks .nav-more-menu{
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  min-width:240px;
  padding:10px;
  border-radius:14px;
  background:#fff;
  box-shadow:0 16px 40px rgba(0,0,0,.14);
  border:1px solid rgba(0,0,0,.08);
  z-index:999;
}

/* Dropdown links */
.navlinks .nav-more-menu a{
  display:block;
  padding:9px 10px;
  border-radius:10px;
  text-decoration:none;
  color:inherit;
  font-weight:600;
}

.navlinks .nav-more-menu a:hover{
  background:rgba(15, 23, 42, 0.06);
}

/* Mobile: make dropdown panel flow naturally inside hamburger menu */
@media (max-width: 820px){
  .navlinks .nav-more{ width:100%; }
  .navlinks .nav-more > summary{ width:100%; }

  .navlinks .nav-more-menu{
    position:static;
    min-width:auto;
    padding:6px 0 0 0;
    border:0;
    box-shadow:none;
    background:transparent;
  }
}


/* --- Mobile nav collapse behavior --- */
@media (max-width: 820px) {
  /* Show hamburger button on mobile */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide nav links by default on mobile */
  #site-nav.navlinks {
    display: none;
    width: 100%;
    padding-top: 10px;
  }

  /* Show when toggled open */
  #site-nav.navlinks.open {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  

  /* Make dropdown behave like a normal item in the vertical list */
  .navlinks .nav-more {
    width: 100%;
  }

  .navlinks .nav-more > summary {
    width: 100%;
  }
}

@media (max-width: 820px) {

  /* When nav is open, make it a clean left-aligned vertical list */
  #site-nav.navlinks.open{
    align-items: stretch;   /* not centered */
    text-align: left;       /* unify text alignment */
  }

  /* Make every top-level nav item full width and left-aligned */
  #site-nav.navlinks.open > a{
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    display: block;
  }

  /* The "More" control should also be full width and left */
  #site-nav.navlinks.open .nav-more{
    width: 100%;
  }

  #site-nav.navlinks.open .nav-more > summary{
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  /* Dropdown list in mobile should behave like normal list items */
  #site-nav.navlinks.open .nav-more-menu a{
    width: 100%;
    text-align: left;
  }
}
