/* One Claim specification site. Custodia UK house style. */
:root {
    --bg: #fafafa;
    --sidebar-bg: #ffffff;
    --sidebar-border: #eee;
    --text: #333333;
    --heading: #1a1a1a;
    --accent: #fbd068;
    --accent-dark: #e8b84a;
    --link: #292828;
    --dark: #292828;
    --muted: #888;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --serif: Georgia, 'Times New Roman', serif;
    --transition: 200ms ease;
    --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; }

body {
    font-family: var(--font);
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration-color: var(--accent); text-underline-offset: 3px; transition: color var(--transition); }
a:hover { color: var(--accent-dark); }
a[target="_blank"]:not(.btn)::after { content: " \2197"; font-size: 0.75em; opacity: 0.5; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 2rem 1.5rem;
    display: flex; flex-direction: column;
    overflow-y: auto;
    z-index: 20;
}

.sidebar-brand { margin-bottom: 2rem; }
.sidebar-brand .client { font-family: var(--serif); font-size: 1.35rem; color: var(--heading); line-height: 1.2; display: block; text-decoration: none; }
.sidebar-brand .doc { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 0.85rem; }

.nav-label { font-family: var(--serif); font-style: italic; font-size: 0.82rem; color: #999; margin: 1.25rem 0 0.4rem; }
.sidebar ul { list-style: none; }
.sidebar li a {
    display: block; padding: 0.3rem 0 0.3rem 0.75rem;
    font-size: 0.88rem; color: var(--heading); text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar li a:hover { border-left-color: var(--sidebar-border); color: var(--heading); background: #fffdf5; }
.sidebar li a.active { font-weight: 600; border-left-color: var(--accent); }

.sidebar-foot { margin-top: auto; padding-top: 2rem; font-size: 0.75rem; color: #aaa; line-height: 1.5; }

.content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
article { padding: 80px; max-width: 1100px; }

/* Mobile menu (checkbox, works without JavaScript) */
.menu-toggle, .menu-button { display: none; }

/* ---------- Typography ---------- */
h1, h2 { font-family: var(--serif); font-weight: 400; color: var(--heading); line-height: 1.25; }
h1 { font-size: 3rem; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
h2 { font-size: 1.8rem; margin-top: 2.5rem; margin-bottom: 1rem; padding-top: 0.5rem; }
h3 { font-size: 1.3rem; font-weight: 600; color: var(--heading); margin-top: 2rem; margin-bottom: 0.6rem; line-height: 1.3; }
h4 { font-size: 1.1rem; font-weight: 600; color: var(--heading); margin-top: 1.5rem; margin-bottom: 0.4rem; }

p { font-size: 1.05rem; line-height: 1.9; max-width: 74ch; margin-bottom: 1rem; }
h2 + p, h3 + p { text-indent: 2em; }
li { max-width: 74ch; line-height: 1.75; }
article > ul, article > ol, section > ul, section > ol { margin: 0 0 1.25rem 1.4rem; }
article li + li { margin-top: 0.3rem; }

.strapline { font-family: var(--serif); font-style: italic; font-size: 1.3rem; color: var(--muted); margin-bottom: 2rem; text-indent: 0; }

.meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 4px solid var(--accent); }
.meta strong { color: var(--heading); font-weight: 600; }

code { font-size: 0.88em; background: #f2f2f2; padding: 0.1em 0.35em; border-radius: 3px; }
pre { background: var(--dark); color: #eee; padding: 1.25rem 1.5rem; border-radius: 6px; overflow-x: auto; font-size: 0.82rem; line-height: 1.6; margin: 1.25rem 0 1.75rem; }
pre code { background: none; padding: 0; color: inherit; }

/* ---------- Design elements ---------- */
.intro-fade p { opacity: 0; animation: fadeIn 0.9s ease forwards; animation-delay: 0.2s; }
.intro-fade p + p { animation-delay: 0.7s; }
.intro-fade p + p + p { animation-delay: 1.2s; }
.intro-links { opacity: 0; animation: fadeIn 0.9s ease forwards; animation-delay: 1.6s; }
@keyframes fadeIn { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .intro-fade p, .intro-links { animation: none; opacity: 1; }
}

.section-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; margin: 2rem 0; }
.section-card {
    display: block; padding: 1.5rem; background: #fff;
    border: 1px solid var(--sidebar-border); border-left: 4px solid var(--accent);
    text-decoration: none; color: var(--text); transition: background var(--transition), border-color var(--transition);
}
.section-card:hover { background: #fffdf5; border-left-color: var(--accent-dark); color: var(--text); }
.section-card h3 { font-family: var(--serif); font-size: 1.15rem; font-weight: 400; margin: 0 0 0.4rem; }
.section-card p { font-size: 0.95rem; color: #555; max-width: none; margin: 0; line-height: 1.6; text-indent: 0; }
.section-card .phase { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--accent-dark); display: block; margin-bottom: 0.35rem; }

.anchor-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 2.5rem; }
.anchor-link {
    display: inline-block; padding: 0.5rem 1.25rem; font-family: var(--serif); font-size: 0.9rem;
    background: #fff; border: 1px solid var(--sidebar-border); border-left: 3px solid var(--accent);
    text-decoration: none; color: var(--heading);
}
.anchor-link:hover { background: #fffdf5; border-left-color: var(--accent-dark); color: var(--heading); }

.pull-quote { border-left: 4px solid var(--accent); padding: 1rem 0 1rem 1.5rem; margin: 2rem 0; font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--heading); max-width: 74ch; line-height: 1.6; }

.highlight-block { border-left: 4px solid var(--accent); background: #fff; padding: 1.25rem 1.5rem; margin: 1.5rem 0; max-width: 80ch; }
.highlight-block h3, .highlight-block h4 { margin-top: 0; }
.highlight-block p:last-child, .highlight-block ul:last-child { margin-bottom: 0; }
.highlight-block ul { margin-left: 1.2rem; }

/* Assumption and question call-outs */
.callout { padding: 1rem 1.25rem; margin: 1.25rem 0; max-width: 80ch; font-size: 0.95rem; border: 1px solid var(--sidebar-border); background: #fff; }
.callout p { font-size: 0.95rem; margin-bottom: 0.4rem; text-indent: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout .tag { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; display: inline-block; margin-bottom: 0.3rem; }
.callout.assume { border-left: 4px solid #bbb; }
.callout.assume .tag { color: #777; }
.callout.ask { border-left: 4px solid var(--accent); background: #fffdf5; }
.callout.ask .tag { color: #a07a14; }

.dark-section { background: var(--dark); color: #ddd; margin: 3rem -80px; padding: 3rem 80px; }
.dark-section h2, .dark-section h3 { color: #fff; margin-top: 0; }
.dark-section p { color: #ddd; }
.dark-section a { color: var(--accent); }
.dark-section a:hover { color: #fff; }

.checklist { list-style: none; margin: 0 0 1.25rem 0 !important; }
.checklist li { padding-left: 1.6rem; position: relative; }
.checklist li::before { content: "\2714"; position: absolute; left: 0; color: var(--accent-dark); }

.cta-section { border-top: 4px solid var(--accent); padding-top: 2.5rem; margin-top: 3rem; }

/* Pipeline / flow */
.flow { list-style: none; counter-reset: step; display: grid; gap: 0; margin: 1.5rem 0 2rem !important; max-width: 80ch; }
.flow li { counter-increment: step; position: relative; background: #fff; border: 1px solid var(--sidebar-border); border-left: 4px solid var(--accent); padding: 0.9rem 1.25rem 0.9rem 3.4rem; margin: 0 !important; max-width: none; }
.flow li + li { margin-top: 1.4rem !important; }
.flow li + li::after { content: "\2193"; position: absolute; top: -1.45rem; left: 1.6rem; color: #bbb; font-size: 1rem; }
.flow li::before { content: counter(step); position: absolute; left: 1rem; top: 0.9rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent); color: var(--heading); font-weight: 700; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; }
.flow strong { color: var(--heading); }
.flow span { display: block; font-size: 0.92rem; color: #555; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: #fff; }
th { text-align: left; padding: 0.7rem 1rem; border-bottom: 2px solid var(--heading); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--sidebar-border); vertical-align: top; line-height: 1.55; }
td code { white-space: nowrap; }

.pill { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: 999px; letter-spacing: 0.03em; white-space: nowrap; }
.pill.cat1 { background: #292828; color: #fbd068; }
.pill.cat2 { background: #eee; color: #555; }
.pill.who { background: #fff6dc; color: #7a5c0c; }
.pill.status { background: #f0f0f0; color: #666; }
.pill.inf { background: #fbd068; color: #1a1a1a; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.5rem 0; }
.two-col > div { background: #fff; border: 1px solid var(--sidebar-border); padding: 1.25rem 1.5rem; }
.two-col h4 { margin-top: 0; }
.two-col ul { margin-left: 1.2rem; font-size: 0.95rem; }

.sources { font-size: 0.85rem; color: #666; }
.sources li { font-size: 0.85rem; }

.page-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--sidebar-border); font-family: var(--serif); }
.page-nav a { text-decoration: none; }

footer.doc-foot { margin-top: 3rem; font-size: 0.78rem; color: #aaa; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    article { padding: 48px; }
    .dark-section { margin: 3rem -48px; padding: 3rem 48px; }
}

@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.4rem; }
    h2 + p, h3 + p { text-indent: 1em; }
    .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
    .menu-toggle:checked ~ .sidebar { transform: translateX(0); box-shadow: 2px 0 12px rgba(0,0,0,0.08); }
    .menu-button {
        display: flex; align-items: center; gap: 0.5rem;
        position: fixed; top: calc(0.75rem + env(safe-area-inset-top, 0px)); right: 0.75rem; z-index: 30;
        background: #fff; border: 1px solid var(--sidebar-border); border-left: 3px solid var(--accent);
        padding: 0.45rem 0.9rem; font-family: var(--serif); font-size: 0.9rem; cursor: pointer;
    }
    .content { margin-left: 0; }
    article { padding: 64px 24px 24px; }
    .dark-section { margin: 3rem -24px; padding: 2.5rem 24px; }
    .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .section-cards { grid-template-columns: 1fr; }
    .flow li { padding-left: 3rem; }
}

@media print {
    .sidebar, .menu-button { display: none; }
    .content { margin-left: 0; }
    article { padding: 0; }
}

/* Idea cards (other applications) */
.idea { background: #fff; border: 1px solid var(--sidebar-border); border-left: 4px solid var(--accent); padding: 1.25rem 1.5rem; margin: 1.25rem 0; max-width: 90ch; }
.idea h3 { margin: 0 0 0.5rem; font-family: var(--serif); font-weight: 400; font-size: 1.2rem; }
.idea .ratings { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.idea p { font-size: 0.95rem; line-height: 1.75; margin-bottom: 0.6rem; text-indent: 0; max-width: none; }
.idea dl { display: grid; grid-template-columns: 9rem 1fr; gap: 0.35rem 1rem; font-size: 0.9rem; margin-top: 0.5rem; }
.idea dt { font-weight: 600; color: var(--heading); }
.idea dd { color: #555; }
.pill.hi { background: #292828; color: #fbd068; }
.pill.med { background: #fff1c4; color: #6b5210; }
.pill.lo { background: #eee; color: #666; }
@media (max-width: 480px) { .idea dl { grid-template-columns: 1fr; } .idea dt { margin-top: 0.4rem; } }

/* Keep headings visible when jumping to an anchor */
[id] { scroll-margin-top: 1.5rem; }
@media (max-width: 768px) { [id] { scroll-margin-top: 4.5rem; } }
