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

:root {
    --color-bg: #FAFAF7;
    --color-bg-warm: #F4F1EB;
    --color-bg-dark: #1B2A1F;
    --color-text: #1C1C1A;
    --color-text-secondary: #5E5E58;
    --color-text-light: #8A8A82;
    --color-green: #0d7537;
    --color-green-soft: #E8F5ED;
    --color-green-light: #00a342;
    --color-orange: #f87c01;
    --color-orange-hover: #e86900;
    --color-orange-soft: #FFF3E8;
    --color-border: #E2E0DA;
    --color-border-light: #EDEBE6;
    --font-display: 'Literata', Georgia, serif;
    --display-weight: 500;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --page-pad: clamp(1.5rem, 4vw, 4rem);
    --max-width: 72rem;
}

::selection { background: #0d753725; color: var(--color-text); }

html { scroll-behavior: smooth; font-size: 24px; }
@media (max-width: 1280px) { html { font-size: 21px; } }
@media (max-width: 1024px) { html { font-size: 19px; } }
@media (max-width: 768px)  { html { font-size: 17px; } }
@media (max-width: 480px)  { html { font-size: 16px; } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration-color: var(--color-border);
    text-underline-offset: 0.2em;
    transition: text-decoration-color 0.2s ease;
}
a:hover { text-decoration-color: var(--color-text); }
img { max-width: 100%; height: auto; display: block; }

/* --- Focus --- */
:focus-visible {
    outline: 2px solid var(--color-green);
    outline-offset: 3px;
    border-radius: 2px;
}

/* --- Nav --- */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 1.1rem var(--page-pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, background 0.3s ease, backdrop-filter 0.3s ease;
}
.nav.scrolled {
    border-bottom-color: var(--color-border);
    background: rgba(250, 250, 247, 0.92);
    backdrop-filter: blur(14px);
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}
.nav-logo svg { width: 30px; height: 30px; }
.nav-logo img { height: 75px; width: auto; }
.nav-links {
    display: flex;
    gap: 2.25rem;
    list-style: none;
    align-items: center;
}
.nav-links a {
    font-size: 0.88rem;
    font-weight: 400;
    text-decoration: none;
    color: var(--color-text-secondary);
    transition: color 0.2s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--color-text); }
.nav-cta {
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    padding: 0.55rem 1.3rem;
    background: var(--color-green);
    color: #fff !important;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
}
.nav-cta:hover { background: #0a6130; transform: translateY(-1px); }
.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}
.nav-mobile-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    margin: 5px 0;
    transition: transform 0.2s ease;
}

/* --- Buttons --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.8rem;
    background: var(--color-orange);
    color: #fff;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(248, 124, 1, 0.15);
}
.btn-primary:hover {
    background: var(--color-orange-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(248, 124, 1, 0.25);
    text-decoration: none;
}
.btn-primary svg { width: 15px; height: 15px; transition: transform 0.2s ease; }
.btn-primary:hover svg { transform: translateX(3px); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    background: transparent;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: border-color 0.2s ease, background 0.2s ease;
}
.btn-ghost:hover {
    border-color: var(--color-text);
    background: var(--color-bg-warm);
    text-decoration: none;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-green);
    text-decoration: none;
    transition: gap 0.2s ease;
}
.text-link:hover { gap: 0.7rem; text-decoration: none; }
.text-link svg { width: 14px; height: 14px; }

/* --- Section shared --- */
.section { padding: 8rem var(--page-pad); }
.section-label {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-green);
    margin-bottom: 1rem;
}

/* --- Page header (inner pages) --- */
.page-header {
    padding: 10rem var(--page-pad) 3rem;
    max-width: 44rem;
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 4.5vw, 3.2rem);
    line-height: 1.12;
    letter-spacing: -0.012em;
    font-weight: var(--display-weight);
    margin-bottom: 1rem;
}
.page-header p {
    font-size: 1.05rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
    max-width: 34rem;
}

/* --- Footer --- */
.footer {
    padding: 2.5rem var(--page-pad);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-light);
    background: var(--color-bg);
}
.footer-legal { font-size: 0.72rem; opacity: 0.7; margin-top: 0.2rem; }
.footer-links { display: flex; gap: 1.5rem; list-style: none; }
.footer-links a { text-decoration: none; color: var(--color-text-secondary); transition: color 0.2s; }
.footer-links a:hover { color: var(--color-text); }

/* --- Mobile menu --- */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--color-bg);
    z-index: 99;
    padding: 6rem 2rem 2rem;
    flex-direction: column;
    gap: 1.75rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
    font-size: 1.4rem;
    font-family: var(--font-display); font-weight: var(--display-weight);
    text-decoration: none;
    color: var(--color-text);
}

/* --- Line endings ---
   Headings split into lines of similar length; paragraphs avoid a stranded
   last word and very uneven rags. Browsers without support wrap normally. */
h1, h2, h3, h4 { text-wrap: balance; }
p, li, figcaption, dd { text-wrap: pretty; }

/* --- Illustrations ---
   Backbone traces of real PDB structures and energy-surface contours, from
   _tools/gen_illustrations.py. Kept faint and behind content (z-index -1 paints
   under in-flow content but over the page background). */
.page-art {
    position: absolute;
    top: 5.5rem;
    right: var(--page-pad);
    width: min(28rem, 38vw);
    aspect-ratio: 1;
    background: no-repeat center / contain;
    opacity: 0.16;
    pointer-events: none;
    z-index: -1;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 95%);
            mask-image: linear-gradient(to bottom, #000 55%, transparent 95%);
}
.page-art--kinase { background-image: url(art/trace-kinase.svg); }
.page-art--kras   { background-image: url(art/trace-kras.svg); }
.page-art--gpcr   { background-image: url(art/trace-gpcr.svg); }
.page-art--pcsk9  { background-image: url(art/trace-pcsk9.svg); }
.page-art--flip   { transform: scaleX(-1); }

/* Section art: graphs and structure cartoons set into space a section leaves
   open. Hidden on phones, where text runs the full width. */
.has-art { position: relative; isolation: isolate; }
.art {
    position: absolute;
    z-index: -1;
    pointer-events: none;
    aspect-ratio: 10 / 7;
    background: no-repeat center / contain;
    opacity: 0.16;
}
.art--square      { aspect-ratio: 1; }
.art--dose        { background-image: url(art/graph-dose-response.svg); }
.art--pk          { background-image: url(art/graph-pk.svg); }
.art--fep         { background-image: url(art/graph-fep.svg); }
.art--enrich      { background-image: url(art/graph-enrichment.svg); }
.art--chemspace   { background-image: url(art/graph-chemspace.svg); }
.art--ppi         { background-image: url(art/ribbon-ppi.svg); }
.art--gpcr        { background-image: url(art/cartoon-gpcr.svg); }
.page-art--kras-ribbon { background-image: url(art/ribbon-kras.svg); }

/* Dark sections carry a light contour field. */
.has-field { position: relative; isolation: isolate; overflow: hidden; }
.has-field::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: url(art/field-dark.svg) center / cover no-repeat;
    opacity: 0.3;
}

/* --- Reveal --- */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .section { padding: 6rem var(--page-pad); }
    .nav { padding: 1.1rem 2rem; }
    /* Six nav items overflow just above the 768px switch to the menu toggle. */
    .nav-links { gap: 1.5rem; }
    .nav-logo img { height: 60px; }
    .page-header { padding: 9rem 2rem 2.5rem; }
    .footer { padding: 2rem; }
}
@media (max-width: 768px) {
    .nav-logo img { height: 44px; }
    /* Behind the header text on phones, so smaller and fainter. Anchored at
       right: 0 because anything past the viewport edge adds a sideways scroll. */
    .page-art { top: 4rem; right: 0; width: 70vw; opacity: 0.09; }
    .art { display: none; }
    .nav-links { display: none; }
    .nav-mobile-toggle { display: block; }
    .section { padding: 4.75rem 1.5rem; }
    .page-header { padding: 7rem 1.5rem 2rem; }
    .page-header h1 { font-size: 1.9rem; }
    .footer { flex-direction: column; gap: 1rem; align-items: flex-start; padding: 2rem 1.5rem; }
}
