/* Penwright section: shared styles for every page in /penwright/.
   Page-specific rules stay in each page's <style> block.
   Colours are tokens; dark mode only redefines the tokens. */

:root {
    --bg: #F5EFE4;
    --surface: #FBF7EE;
    --surface-2: #EEE7D6;
    --line: #D8D0BE;
    --rule: #9A9082;
    --ink: #1F1B16;
    --text: #3D372E;
    --muted: #6A655B;
    --faint: #9A9082;
    --accent: #2D6A4F;
    --accent-strong: #1B4332;
    --accent-ink: #F5EFE4;
    --tint: #EAF2EC;
    --tint-line: #D5E3D8;
    --tint-ink: #1B4332;
    --danger: #A94B37;
    --danger-bg: rgba(169,75,55,0.08);
    --danger-line: rgba(169,75,55,0.35);
    --shadow: 0 6px 24px rgba(45,106,79,0.14);
    --radius: 16px;
    --serif: 'Newsreader', Georgia, serif;
    --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
    --bg: #15140F;
    --surface: #1F1D16;
    --surface-2: #2A271E;
    --line: #3D372E;
    --rule: #6A655B;
    --ink: #EDE6D3;
    --text: #C7BFA8;
    --muted: #999283;
    --faint: #6A655B;
    --accent: #74C69D;
    --accent-strong: #95D5B2;
    --accent-ink: #15140F;
    --tint: #22302A;
    --tint-line: #2A3B33;
    --tint-ink: #95D5B2;
    --danger: #E0876A;
    --danger-bg: rgba(224,135,106,0.08);
    --danger-line: rgba(224,135,106,0.35);
    --shadow: 0 6px 24px rgba(0,0,0,0.35);
}

/* ---------- Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--sans); background: var(--bg); color: var(--ink);
    line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column;
}
body::before {
    content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 9999; opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; box-shadow: 0 0 0 2px var(--bg); border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code { font-family: var(--mono); font-size: 0.87em; background: var(--surface-2); color: var(--ink); padding: 2px 6px; border-radius: 4px; }
main { flex: 1; }
[id] { scroll-margin-top: 84px; }

/* ---------- Launch phase ----------
   pw-boot.js sets data-phase="live" on <html> from launch day.
   .pre = pre-launch only, .live = after launch only. Without JS, pre-launch shows. */
.live { display: none !important; }
[data-phase="live"] .pre { display: none !important; }
[data-phase="live"] .live { display: revert !important; }

/* ---------- Top bar ---------- */
.topbar {
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
    position: sticky; top: 0; z-index: 50;
}
.topbar a { text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; transition: color 0.2s; }
.topbar a:hover { color: var(--accent); }
.topbar a[aria-current="page"] { color: var(--ink); }
.topbar .studio-name { font-family: var(--serif); font-weight: 600; color: var(--ink); font-size: 16px; }
.topbar-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.theme-toggle {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink);
    cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), border-color 0.2s;
}
.theme-toggle:hover { transform: rotate(-15deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .topbar { background: var(--surface); }
@media (max-width: 560px) {
    .topbar { padding: 12px 16px; }
    .topbar-nav { order: 3; width: 100%; gap: 18px; }
    .topbar .contact-link { display: none; }
}

/* ---------- Type ---------- */
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
h1 { font-family: var(--serif); font-size: 34px; color: var(--ink); margin-bottom: 6px; font-weight: 600; line-height: 1.2; }
h2 { font-family: var(--serif); font-size: 21px; color: var(--ink); font-weight: 600; line-height: 1.3; }
h3 { color: var(--ink); }
.subtitle, .last-updated { color: var(--muted); font-size: 16px; margin-bottom: 12px; }
.last-updated { font-size: 14px; font-style: italic; }
.double-rule { border: 0; border-top: 1px solid var(--line); border-bottom: 2px solid var(--rule); height: 4px; margin: 0 0 32px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none;
    padding: 13px 26px; border-radius: 12px; font-weight: 600; font-size: 16px; border: 0; cursor: pointer;
    font-family: var(--sans); transition: background 0.2s;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn-soft {
    display: inline-block; color: var(--tint-ink); background: var(--tint); border: 1px solid var(--tint-line);
    padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn-soft:hover { background: var(--tint-line); text-decoration: none; }

/* ---------- Document pages (FAQ, support, legal, press) ---------- */
.doc-main { padding: 48px 24px 60px; }
.container { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); padding: 48px; border-radius: var(--radius); }
.container h2 { margin-top: 32px; margin-bottom: 12px; }
.container h3 { font-size: 16px; margin-top: 20px; margin-bottom: 8px; font-weight: 600; }
.container p { margin-bottom: 16px; color: var(--text); font-size: 15px; }
.container ul { margin: 16px 0; padding-left: 24px; }
.container li { margin-bottom: 8px; color: var(--text); }
.back-link { display: inline-block; margin-bottom: 24px; font-size: 14px; font-weight: 500; }
.callout, .contact, .contact-card { background: var(--tint); border: 1px solid var(--tint-line); padding: 20px 24px; border-radius: 12px; margin-top: 32px; }
.callout p:last-child, .contact p:last-child, .contact-card p:last-child { margin-bottom: 0; }
.contact-card { margin-top: 0; margin-bottom: 8px; }
.contact-card h2 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; margin: 16px 0 8px; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: top; }
th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
@media (max-width: 768px) {
    .doc-main { padding: 28px 16px 48px; }
    .container { padding: 28px 22px; }
    h1 { font-size: 26px; }
    .container h2 { font-size: 18px; }
    table { font-size: 13px; }
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 28px 24px; text-align: center; color: var(--muted); font-size: 13px; }
footer .legal-links { margin-bottom: 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; }
footer .legal-links a { color: var(--accent); font-weight: 500; }
footer .legal-links a + a::before { content: '\00b7'; color: var(--faint); margin: 0 10px; display: inline-block; }
footer img { max-width: 165px; height: auto !important; margin-top: 14px; filter: grayscale(1); opacity: 0.5; transition: filter 0.3s ease, opacity 0.3s ease; }
footer a:hover img { filter: none; opacity: 1; }
