/* Swiss Resident Brief – mobile-first stylesheet.
   Brand (matches @SwissResBrief on X): Swiss red #AE050B, white, mountain motif.
   Base rules target phones; min-width media queries add layout for larger screens. */

:root {
  --red: #ae050b;
  --red-dark: #8a0408;
  --red-soft: #fbeaea;
  --bg: #ffffff;
  --surface: #f6f5f3;
  --text: #1c1c1e;
  --muted: #55555c;
  --border: #e3e1dd;
  --link: #ae050b;
  --focus: #1a5fd0;
  --radius: 14px;
  --wrap: 70rem;
  --measure: 44rem;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --surface: #1d1d20;
    --text: #ececef;
    --muted: #a8a8b0;
    --border: #34343a;
    --red-soft: #35121a;
    --link: #ff7a7e;
    --focus: #7fb0ff;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 1.0625rem/1.65 var(--font); text-rendering: optimizeLegibility; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
p, li { text-wrap: pretty; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; color: var(--red); padding: 10px 14px; border-radius: 8px; z-index: 20; font-weight: 700; }
.skip-link:focus { left: 8px; }

/* Header: sticky, compact on phones */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--red); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 750; font-size: 1rem; white-space: nowrap; }
.brand img { width: 32px; height: 32px; border-radius: 8px; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.brand-name-short { display: inline; }
.brand-name-full { display: none; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: #fff; text-decoration: none; font-weight: 650; font-size: .95rem; padding: 10px 10px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.site-nav a:hover { background: rgba(255,255,255,.12); }
.site-nav a[aria-current="page"] { background: rgba(255,255,255,.2); }
.site-nav a.nav-x { gap: 8px; margin-left: 4px; padding: 10px 12px; background: #fff; color: var(--red); border-radius: 999px; }
.site-nav a.nav-x:hover { background: #fdeeee; }
.nav-x-label { display: none; }
@media (max-width: 400px) {
  .header-inner { gap: 8px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 10px 7px; font-size: .9rem; }
  .site-nav a.nav-x { padding: 10px 11px; margin-left: 2px; }
}
@media (min-width: 720px) { .nav-x-label { display: inline; } }

/* Hero – same look as the X banner */
.hero { background: var(--red) url("/assets/img/mountains.svg") no-repeat bottom / 100% 60px; color: #fff; padding: 36px 0 84px; }
.hero h1 { font-size: clamp(2rem, 8vw, 3.4rem); margin: 0; }
.hero-tagline { font-size: clamp(1.15rem, 4.5vw, 1.55rem); margin: 4px 0 16px; opacity: .95; font-weight: 500; }
.hero-text { max-width: 38rem; margin: 0 0 22px; opacity: .93; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; background: #fff; color: var(--red); font-weight: 750; padding: 12px 22px; border-radius: 999px; text-decoration: none; }
.button:hover { background: #fdeeee; }
.button.ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.8); }
.button.ghost:hover { background: rgba(255,255,255,.12); }

/* Sections and cards */
main { display: block; }
.section { padding: 28px 0; }
.section h2 { font-size: 1.45rem; margin: 0 0 6px; }
.section-intro { color: var(--muted); margin: 0 0 16px; max-width: var(--measure); }
.page-header { padding: 28px 0 8px; }
.page-header h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); margin: 0 0 8px; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: var(--measure); margin: 0 0 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .07em; font-size: .76rem; font-weight: 750; color: var(--link); margin: 0; }
.meta { color: var(--muted); font-size: .9rem; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: 1fr; }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--red); border-radius: var(--radius); padding: 18px; transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }
.card h2, .card h3 { font-size: 1.12rem; margin: 6px 0 8px; }
.card h2 a, .card h3 a { color: var(--text); text-decoration: none; }
.card h2 a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card is clickable */
.card p { margin: 0 0 8px; }
.card-has-thumb { padding-top: 0; overflow: hidden; display: flex; flex-direction: column; }
.card-thumb { display: block; width: calc(100% + 36px); max-width: none; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin: 0 -18px 12px; background: var(--border); }
.card-credit { font-size: .7rem; color: var(--muted); margin-top: auto !important; padding-top: 6px; position: relative; z-index: 1; }
.card-credit a { color: inherit; }

.pillars { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pillars li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-weight: 650; font-size: .95rem; }
.pillars span { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; }

.x-embed { margin: 32px 0; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.x-embed h2 { margin-top: 0; }
.x-embed .button { background: var(--red); color: #fff; }
.x-embed .button:hover { background: var(--red-dark); }
.update-list { list-style: none; padding: 0; margin: 0; }
.update-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.update-meta { margin: 0 0 2px; color: var(--muted); font-size: .85rem; }
.update-summary { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.update-list a { font-weight: 600; font-size: 1.05rem; }
.more-link { display: inline-block; margin-top: 12px; font-weight: 650; min-height: 44px; padding: 10px 0; }

/* Guide and update pages */
.article { padding-top: 12px; padding-bottom: 40px; }
.article-inner { max-width: var(--measure); }
.breadcrumbs { font-size: .88rem; color: var(--muted); padding: 8px 0; overflow-x: auto; white-space: nowrap; }
.breadcrumbs a { color: var(--muted); }
.article h1 { font-size: clamp(1.8rem, 6.5vw, 2.6rem); margin: 6px 0 10px; }
.reviewed { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: .85rem; color: var(--muted); }
.reviewed::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #1f9d55; }

.hero-figure { margin: 16px -16px 20px; }
.hero-figure img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface); }
.hero-figure figcaption { font-size: .78rem; line-height: 1.45; color: var(--muted); padding: 6px 16px 0; }
.hero-figure figcaption a { color: inherit; }
@media (min-width: 560px) { .hero-figure { margin: 16px 0 20px; } .hero-figure img { border-radius: var(--radius); } .hero-figure figcaption { padding: 6px 0 0; } }
.answer { background: var(--red); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin: 20px 0; }
.answer h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 6px; opacity: .9; }
.answer p { margin: 0; font-size: 1.08rem; line-height: 1.55; }
.answer a { color: #fff; }

.key-facts { background: var(--red-soft); border-left: 5px solid var(--red); border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; }
.key-facts h2 { margin: 0 0 6px; font-size: 1.05rem; }
.key-facts ul { margin: 0; padding-left: 1.15rem; }
.key-facts li { margin: 7px 0; }

.toc { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px; margin: 20px 0; background: var(--bg); }
.toc summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.toc ol { margin: 0 0 12px; padding-left: 1.2rem; }
.toc li { margin: 6px 0; }

.prose h2 { margin-top: 2em; font-size: 1.4rem; }
.prose h3 { margin-top: 1.6em; font-size: 1.15rem; }
.prose li { margin: 6px 0; }
.prose ol, .prose ul { padding-left: 1.25rem; }
.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }

.faq { margin-top: 32px; }
.faq h2 { font-size: 1.4rem; }
.faq details { border: 1px solid var(--border); border-radius: 12px; margin: 10px 0; background: var(--surface); }
.faq summary { cursor: pointer; font-weight: 650; padding: 12px 16px; min-height: 48px; display: flex; align-items: center; }
.faq details > div { padding: 0 16px 12px; }

.related { margin-top: 32px; }
.related h2 { font-size: 1.2rem; }
.sources { border-top: 1px solid var(--border); margin-top: 36px; padding-top: 8px; }
.sources h2 { font-size: 1.15rem; }
.sources li { margin: 8px 0; overflow-wrap: anywhere; }
.source-meta { color: var(--muted); font-size: .9rem; }
.disclaimer { color: var(--muted); font-size: .9rem; }
.back-to-top { display: inline-block; margin-top: 16px; min-height: 44px; padding: 10px 0; font-weight: 600; }

/* Footer */
.site-footer { background: var(--surface); border-top: 4px solid var(--red); color: var(--muted); font-size: .92rem; padding: 24px 0 32px; margin-top: 24px; }
.footer-inner { display: grid; gap: 14px; }
.site-footer nav { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; }

/* Larger phones and tablets */
@media (min-width: 560px) {
  .brand-name-short { display: none; }
  .brand-name-full { display: inline; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .pillars { grid-template-columns: repeat(3, 1fr); }
  .hero { background-size: 100% 90px; padding: 48px 0 110px; }
}

/* Desktop */
@media (min-width: 960px) {
  :root { --gutter: 24px; }
  body { font-size: 1.0625rem; }
  .header-inner { min-height: 64px; }
  .site-nav a { padding: 10px 14px; }
  .hero { background-size: 100% 130px; padding: 72px 0 150px; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .pillars { grid-template-columns: repeat(6, 1fr); }
  .section { padding: 40px 0; }
  .footer-inner { grid-template-columns: 1fr auto; align-items: start; }
  .article-layout { display: grid; grid-template-columns: minmax(0, var(--measure)) 16rem; gap: 48px; }
  .article-layout .toc { position: sticky; top: 88px; align-self: start; margin-top: 0; }
  .toc-mobile { display: none; }
}
@media (max-width: 959px) {
  .toc-desktop { display: none; }
}

@media print {
  .site-header, .site-footer, .toc, .back-to-top, .hero-actions { display: none; }
  body { color: #000; background: #fff; }
  a { color: #000; }
}
