/* home.css
   sansarabil.com, the public page. Same colour tokens as the paper site
   (css/tokens.css of the paper-ideas site) so that the login screen and
   the papers feel like one place. Light by default, dark when the system
   or the saved choice says so. */

:root {
  --bg: #f4f6f8; --surface: #ffffff; --surface-2: #eef1f4; --text: #16191d; --muted: #4c545e; --faint: #626a76;
  --rule: #d7dce2; --rule-strong: #b6bec8; --primary: #1d5aa3; --primary-strong: #164a87; --primary-on: #ffffff;
  --primary-tint: #e3edf9; --accent: #a3125a; --accent-tint: #fbeaf2; --focus: #a3125a;
  --f-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --f-serif: Georgia, "Times New Roman", "Noto Serif", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --surface: #1d2026; --surface-2: #242830; --text: #e4e7eb; --muted: #a8b0ba; --faint: #868f9a;
    --rule: #2c313a; --rule-strong: #414954; --primary: #8fb8f0; --primary-strong: #a9c9f5; --primary-on: #14161a;
    --primary-tint: #1b2a3d; --accent: #f27bb0; --accent-tint: #33202b; --focus: #f27bb0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a; --surface: #1d2026; --surface-2: #242830; --text: #e4e7eb; --muted: #a8b0ba; --faint: #868f9a;
  --rule: #2c313a; --rule-strong: #414954; --primary: #8fb8f0; --primary-strong: #a9c9f5; --primary-on: #14161a;
  --primary-tint: #1b2a3d; --accent: #f27bb0; --accent-tint: #33202b; --focus: #f27bb0;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--f-sans); font-size: 18px; line-height: 1.65; }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--primary-strong); text-decoration-thickness: 2px; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 10; padding: 10px 14px; background: var(--primary); color: var(--primary-on); border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--rule); }
.top-row { display: flex; align-items: center; min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; width: 100%; }
.nav .lang-btn { margin-left: auto; }
.nav a { display: inline-block; padding: 8px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600; min-height: 40px; line-height: 24px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav-papers { color: var(--primary) !important; }
.nav a[aria-current="page"] { color: var(--primary); background: var(--primary-tint); }
.writing-main { min-height: calc(100vh - 160px); }
.writing-back { margin-top: 24px; }
.lang-btn { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; }
.lang-btn:hover { background: var(--surface-2); color: var(--text); }
.lang-on { color: var(--faint); }
.lang-on.is-current { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.lang-sep { color: var(--rule-strong); }

/* hero */
.hero { padding-top: 56px; padding-bottom: 40px; }
.kicker { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
h1 { margin: 0 0 20px; font-family: var(--f-serif); font-size: 44px; line-height: 1.1; letter-spacing: -0.01em; font-weight: 700; }
.lead { margin: 0 0 20px; font-size: 21px; line-height: 1.5; color: var(--text); max-width: 40ch; }
.affil { margin: 0 0 28px; color: var(--muted); }
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 10px 20px; border: 1px solid var(--primary); border-radius: 10px; background: var(--primary); color: var(--primary-on); font-weight: 700; text-decoration: none; }
.btn:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: var(--primary-on); }
.btn-quiet { background: transparent; color: var(--primary); }
.btn-quiet:hover { background: var(--primary-tint); color: var(--primary-strong); }

/* sections */
.section { padding: 36px 16px; border-top: 1px solid var(--rule); }
h2 { margin: 0 0 18px; font-family: var(--f-serif); font-size: 30px; line-height: 1.2; }
h3 { margin: 0 0 10px; font-size: 21px; line-height: 1.3; }
h3.sub { margin-top: 28px; font-size: 17px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
p { margin: 0 0 16px; }
.card { padding: 22px 24px; margin: 0 0 8px; border: 1px solid var(--rule); border-left: 5px solid var(--accent); border-radius: 12px; background: var(--surface); }
.card p:last-child { margin-bottom: 0; }
.themes { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.themes li { padding: 16px 18px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.themes strong { display: block; margin-bottom: 4px; }
.pubs, .talks { margin: 0; padding: 0 0 0 1.3em; }
.pubs li, .talks li { margin: 0 0 14px; }
.pub-title { font-weight: 700; }
.pub-link { display: inline-block; margin-left: 4px; font-size: 15px; }
.contact-line { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; align-items: baseline; }
.contact-line .label { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); line-height: 1.6; }
.links { display: flex; flex-wrap: wrap; gap: 6px 0; }
.links a + a::before { content: "·"; margin: 0 12px; color: var(--rule-strong); text-decoration: none; display: inline-block; }
.email { font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace; font-size: 17px; line-height: 1.5; padding: 4px 10px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); color: var(--primary); cursor: pointer; min-height: 40px; justify-self: start; text-align: left; max-width: 100%; overflow-wrap: anywhere; }
.boxlink { display: inline-block; justify-self: start; font-size: 17px; line-height: 1.5; padding: 4px 14px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); color: var(--primary); font-weight: 700; text-decoration: none; min-height: 40px; }
.boxlink:hover { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-strong); text-decoration: none; }
.email:hover { border-color: var(--primary); background: var(--primary-tint); }
.email:active { background: var(--primary-tint); border-color: var(--primary-strong); }
.copy-note { font-size: 15px; font-weight: 600; color: var(--faint); opacity: 0; transition: opacity 0.2s; }
.copy-note.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .copy-note { transition: none; } }
#contact:target { scroll-margin-top: 80px; }
.section { scroll-margin-top: 70px; }

/* footer */
.foot { border-top: 1px solid var(--rule); margin-top: 24px; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding-top: 20px; padding-bottom: 32px; font-size: 15px; color: var(--muted); }
.foot p { margin: 0; }
.faint { color: var(--faint); }

@media (max-width: 520px) {
  body { font-size: 17px; }
  h1 { font-size: 36px; }
  .lead { font-size: 19px; }
  .nav a { padding: 8px 8px; }
  .contact-line { grid-template-columns: 1fr; gap: 4px; }
  .contact-line + .contact-line { margin-top: 6px; }
  .links { flex-direction: column; gap: 10px; }
  .links a + a::before { content: none; margin: 0; }
}
@media (forced-colors: active) {
  .card, .themes li { border: 1px solid CanvasText; }
  .btn { border: 1px solid ButtonText; }
}
@media print {
  .top, .foot, .hero-links, .skip-link { display: none; }
  body { font-size: 12pt; }
  a { color: inherit; text-decoration: none; }
}

/* Public reading hierarchy, 1 November 2026.
   Front-load information and align headings with the text scan path.
   F-pattern describes reading behavior, not a prescribed decorative shape. */
.wrap { max-width: 880px; padding-left: 24px; padding-right: 24px; }
.hero { padding-top: 40px; padding-bottom: 32px; }
h1 { font-size: clamp(32px, 4vw, 42px); line-height: 1.15; margin-bottom: 20px; }
.lead { max-width: 53ch; font-size: 23px; line-height: 1.45; font-weight: 600; margin-bottom: 14px; }
.approach { max-width: 62ch; font-size: 18px; margin-bottom: 20px; }
.affil { font-size: 15px; line-height: 1.55; margin-bottom: 22px; }
.section { padding-top: 30px; padding-bottom: 30px; scroll-margin-top: 90px; }
.section > p, .card > p, .themes, .pubs, .talks { max-width: 70ch; }
h2 { font-size: 28px; margin-bottom: 22px; }
h3 { font-size: 21px; }
#about h3:not(:first-of-type) { margin-top: 24px; }
.card { border: 0; border-radius: 0; padding: 0; background: transparent; }
.project-title { font-size: 16px; color: var(--muted); margin-top: -4px; margin-bottom: 12px; }
.themes { gap: 0; }
.themes li { border: 0; border-top: 1px solid var(--rule); border-radius: 0; padding: 16px 0; background: transparent; }
.themes strong { font-size: 19px; margin-bottom: 5px; }
.themes span { display: block; }
.pubs .pub-title { display: block; margin-bottom: 5px; }
.pubs li, .talks li { padding-left: 2px; }
.btn { border-radius: 4px; padding: 9px 16px; }
.nav a, .lang-btn, .email, .boxlink { border-radius: 3px; }
.nav a:first-child { margin-left: -10px; }
.writing-main { min-height: calc(100vh - 156px); }
.writing-main .hero { padding-bottom: 24px; }
.writing-main .lead { font-size: 20px; font-weight: 400; }
.writing-main .section { padding-top: 24px; }
.writing-main h2 { font-size: 23px; margin-bottom: 12px; }
@media (max-width: 760px) { .top { position: static; } .section { scroll-margin-top: 16px; } }
@media (max-width: 520px) {
 .wrap { padding-left: 20px; padding-right: 20px; }
 .hero { padding-top: 28px; padding-bottom: 26px; }
 .lead { font-size: 21px; }
 .approach { font-size: 17px; }
 h2 { font-size: 25px; }
 .section { padding-top: 26px; padding-bottom: 26px; }
 .nav a:first-child { margin-left: -8px; }
}
@media print {
 body { background: white; color: black; }
 .hero { padding-top: 0; }
 main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; overflow-wrap: anywhere; }
}
