/* ==========================================================================
   simulai.org — The Institute for Computational Simulation Studies
   Palette: muted-vintage · Layout: stacked-sections · Type: serif-classic
   ========================================================================== */

:root {
    --bg-light: #F5F2EC;
    --bg-alt: #FFFFFF;
    --bg-dark: #2A2835;
    --color-primary: #7A6B8A;
    --color-secondary: #5A8A7E;
    --color-accent: #B8A060;
    --text-primary: #2A2830;
    --text-secondary: #7A7570;
    --divider-dot: #C8C0B4;

    --font-serif: "Lora", Georgia, "Times New Roman", serif;
    --font-sans: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "DM Mono", "Courier New", monospace;

    --max-content: 1100px;
    --section-gap: 60px;
    --header-height: 40px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-light);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.85;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* =========================================================================
   Running Header
   ========================================================================= */
.running-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(245, 242, 236, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(122, 107, 138, 0.15);
    z-index: 100;
    overflow: hidden;
}

.running-header__inner {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    gap: 24px;
}

.running-header__brand {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--color-primary);
    text-transform: lowercase;
}

.brand-mark {
    white-space: nowrap;
}

.running-header__section {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    overflow: hidden;
}

.section-marker {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-accent);
    letter-spacing: 0.1em;
    transition: opacity 0.35s ease;
}

.section-title-text {
    font-family: var(--font-serif);
    font-size: 13px;
    font-style: italic;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    text-transform: uppercase;
    transition: opacity 0.35s ease, transform 0.35s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-title-text.is-transition {
    opacity: 0;
    transform: translateY(-4px);
}

.running-header__meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
}

.meta-dot {
    opacity: 0.5;
}

.scan-line {
    position: absolute;
    top: 0;
    left: -30%;
    width: 30%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(122, 107, 138, 0.12) 50%,
        transparent 100%
    );
    pointer-events: none;
    animation: scanlineSweep 14s linear infinite;
}

@keyframes scanlineSweep {
    0% { left: -30%; }
    70% { left: 130%; }
    100% { left: 130%; }
}

/* =========================================================================
   Document / Section stack
   ========================================================================= */
.document {
    padding-top: var(--header-height);
}

.section {
    position: relative;
    min-height: 90vh;
    padding: 10vh 0 12vh;
    overflow: hidden;
}

.section--light {
    background: var(--bg-light);
}

.section--alt {
    background: var(--bg-alt);
}

.section--dark {
    background: var(--bg-dark);
    color: #E7E2D8;
}

.section--final {
    padding-bottom: 14vh;
}

.section__inner {
    position: relative;
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 32px;
    z-index: 2;
}

/* Large faded background section number */
.section__number-bg {
    position: absolute;
    top: 40px;
    left: max(16px, calc(50% - (var(--max-content) / 2) - 40px));
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 160px;
    line-height: 1;
    color: var(--divider-dot);
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
    z-index: 1;
    letter-spacing: -0.02em;
    will-change: transform;
}

.section__number-bg--dark {
    color: #4A4555;
    opacity: 0.55;
}

/* Section title + subtitle */
.section__title {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(1.85rem, 3.6vw, 2.8rem);
    letter-spacing: 0.01em;
    color: var(--text-primary);
    margin: 0 0 12px;
    line-height: 1.2;
    position: relative;
    padding-left: 0;
}

.section__title--light {
    color: #F5F2EC;
}

.title-marker {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    color: var(--color-accent);
    letter-spacing: 0.12em;
    margin-right: 14px;
    vertical-align: middle;
    padding: 4px 8px;
    border: 1px solid rgba(184, 160, 96, 0.4);
}

.title-marker--light {
    color: #D6C28A;
    border-color: rgba(214, 194, 138, 0.4);
}

.section__subtitle {
    font-family: var(--font-serif);
    font-weight: 400;
    font-style: italic;
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin: 0 0 48px;
    letter-spacing: 0.005em;
    max-width: 720px;
}

.section__subtitle--light {
    color: #B8AFC1;
}

/* Decorative divider: row of small dots */
.section__divider {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100% - 64px), var(--max-content));
    height: 8px;
    background-image: radial-gradient(
        circle,
        var(--divider-dot) 0,
        var(--divider-dot) 2px,
        transparent 2.5px
    );
    background-size: 12px 8px;
    background-repeat: repeat-x;
    background-position: center;
    opacity: 0.4;
    pointer-events: none;
}

.section__divider--dark {
    background-image: radial-gradient(
        circle,
        #6A6475 0,
        #6A6475 2px,
        transparent 2.5px
    );
    opacity: 0.55;
}

/* =========================================================================
   Masthead (Section 01)
   ========================================================================= */
.masthead {
    padding: 4vh 0 2vh;
}

.masthead__eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.16em;
    color: var(--color-primary);
    text-transform: uppercase;
    margin-bottom: 24px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.eyebrow-bracket {
    color: var(--color-accent);
    font-weight: 500;
}

.masthead__title {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(2rem, 4.5vw, 3.6rem);
    letter-spacing: 0.01em;
    line-height: 1.15;
    margin: 0 0 20px;
    color: var(--text-primary);
    max-width: 920px;
}

.masthead__subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.35rem;
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 780px;
    margin: 0 0 48px;
}

.masthead__meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    padding: 24px 0;
    margin: 0 0 48px;
    border-top: 1px solid rgba(42, 40, 48, 0.12);
    border-bottom: 1px solid rgba(42, 40, 48, 0.12);
}

.meta-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.meta-value {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.9rem;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.masthead__lead {
    max-width: 780px;
    color: var(--text-primary);
}

.masthead__lead p {
    margin: 0 0 1.2em;
    font-size: 1.05rem;
}

.masthead__lead p:last-child {
    margin-bottom: 0;
}

/* =========================================================================
   Prose / text body
   ========================================================================= */
.prose {
    max-width: 720px;
    margin: 0 auto 40px 0;
}

.prose p {
    margin: 0 0 1.2em;
}

.prose p:last-child {
    margin-bottom: 0;
}

/* Footnote marker */
.fn-marker {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background: var(--color-primary);
    color: #FFFFFF;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    vertical-align: super;
    margin: 0 2px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    user-select: none;
    letter-spacing: 0;
}

.fn-marker:hover {
    background: var(--color-accent);
    transform: translateY(-1px) scale(1.1);
}

.fn-marker--light {
    background: #B8A060;
    color: #2A2835;
}

.fn-marker--light:hover {
    background: #D4BD7A;
}

/* =========================================================================
   Commitments (Section 02)
   ========================================================================= */
.commitments {
    list-style: none;
    padding: 0;
    margin: 40px 0 48px;
    max-width: 780px;
    counter-reset: none;
}

.commitment {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 24px;
    padding: 24px 0;
    border-top: 1px solid rgba(122, 107, 138, 0.2);
    align-items: baseline;
}

.commitment:last-child {
    border-bottom: 1px solid rgba(122, 107, 138, 0.2);
}

.commitment__num {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--color-accent);
    letter-spacing: 0.08em;
}

.commitment__heading {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.2rem;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.commitment__body p {
    margin: 0;
    color: var(--text-primary);
}

/* =========================================================================
   Pull Quote
   ========================================================================= */
.pullquote {
    position: relative;
    margin: 48px 0 0;
    padding: 40px 56px 36px;
    background: rgba(122, 107, 138, 0.05);
    border-left: 2px solid var(--color-accent);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.35rem;
    line-height: 1.55;
    color: var(--text-primary);
    max-width: 860px;
}

.pullquote::before,
.pullquote::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1px solid var(--color-primary);
    opacity: 0.5;
}

.pullquote::before {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

.pullquote::after {
    bottom: 10px;
    right: 10px;
    border-left: none;
    border-top: none;
}

.pullquote__open {
    position: absolute;
    top: 8px;
    left: 28px;
    font-family: var(--font-serif);
    font-size: 4rem;
    color: var(--color-accent);
    opacity: 0.6;
    line-height: 1;
    font-style: normal;
}

.pullquote p {
    margin: 0 0 1em;
}

.pullquote cite {
    display: block;
    font-family: var(--font-mono);
    font-style: normal;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-top: 8px;
    text-transform: uppercase;
}

/* =========================================================================
   Icon Grid (Section 03)
   ========================================================================= */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 24px 0 40px;
}

.icon-cell {
    position: relative;
    padding: 28px 20px 20px;
    background: var(--bg-alt);
    border: 1px solid rgba(122, 107, 138, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    transition: border-color 0.4s ease, transform 0.4s ease;
    min-height: 190px;
}

.section--alt .icon-cell {
    background: var(--bg-light);
}

.icon-cell:hover {
    border-color: rgba(122, 107, 138, 0.45);
    transform: translateY(-2px);
}

.icon-cell:hover .reticle-corner {
    opacity: 1;
}

.icon-cell__reticle {
    position: absolute;
    inset: 8px;
    pointer-events: none;
}

.reticle-corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--color-primary);
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.reticle-corner--tl {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.reticle-corner--tr {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.reticle-corner--bl {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.reticle-corner--br {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.icon-cell__svg {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-cell__svg svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-cell__svg svg .filled {
    fill: var(--color-primary);
    stroke: var(--color-primary);
}

.icon-cell__label {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.icon-cell__code {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    margin-top: auto;
}

.fieldnote {
    max-width: 720px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    padding: 16px 0 0;
    border-top: 1px dotted rgba(122, 107, 138, 0.3);
    margin-top: 24px;
}

/* =========================================================================
   Timeline (Section 04)
   ========================================================================= */
.timeline {
    list-style: none;
    padding: 0;
    margin: 40px 0;
    position: relative;
    max-width: 840px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 80px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(122, 107, 138, 0.35) 10%,
        rgba(122, 107, 138, 0.35) 90%,
        transparent
    );
}

.timeline__entry {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 28px;
    padding: 22px 0;
    position: relative;
}

.timeline__entry::before {
    content: "";
    position: absolute;
    left: 75px;
    top: 32px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 1.5px solid var(--color-accent);
    z-index: 2;
}

.section--alt .timeline__entry::before {
    background: var(--bg-alt);
}

.timeline__year {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--color-primary);
    letter-spacing: 0.04em;
    padding-top: 2px;
}

.timeline__body h3 {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.15rem;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.timeline__body p {
    margin: 0;
    color: var(--text-primary);
}

/* =========================================================================
   Meditation (Section 05 - dark)
   ========================================================================= */
.meditation {
    max-width: 740px;
    margin: 40px 0 36px;
    color: #DDD6C7;
    font-size: 1.08rem;
    line-height: 1.9;
}

.meditation p {
    margin: 0 0 1.2em;
}

.meditation em {
    color: #E8D9A8;
}

.meditation__signature {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    max-width: 740px;
    padding-top: 24px;
}

.sig-line {
    width: 120px;
    height: 1px;
    background: #B8A060;
    opacity: 0.6;
    margin-bottom: 12px;
}

.sig-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1rem;
    color: #E8D9A8;
}

.sig-date {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    color: #9A93A5;
}

/* =========================================================================
   Publications (Section 06)
   ========================================================================= */
.publications {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pub {
    display: grid;
    grid-template-columns: 110px 1fr 160px;
    gap: 28px;
    padding: 28px 0;
    border-top: 1px solid rgba(42, 40, 48, 0.12);
    align-items: start;
}

.pub:last-child {
    border-bottom: 1px solid rgba(42, 40, 48, 0.12);
}

.pub__ref {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-accent);
    letter-spacing: 0.08em;
    padding-top: 6px;
}

.pub__title {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.25rem;
    margin: 0 0 4px;
    color: var(--text-primary);
    line-height: 1.3;
}

.pub__authors {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.pub__abstract {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.98rem;
    line-height: 1.7;
}

.pub__tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--color-secondary);
    text-align: right;
    padding: 5px 10px;
    border: 1px solid rgba(90, 138, 126, 0.4);
    align-self: start;
    justify-self: end;
    white-space: nowrap;
}

/* =========================================================================
   Colophon (Section 07)
   ========================================================================= */
.colophon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px 48px;
    margin: 32px 0 48px;
}

.colophon-cell {
    padding: 20px 0 20px 24px;
    border-left: 1px solid rgba(122, 107, 138, 0.3);
}

.colophon-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--color-accent);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.colophon-cell p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.98rem;
}

.colophon-footer {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid rgba(42, 40, 48, 0.12);
    margin-top: 24px;
}

.colophon-brackets {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.16em;
    color: var(--color-primary);
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.bracket-left,
.bracket-right {
    color: var(--color-accent);
    font-size: 16px;
}

.colophon-mark {
    text-transform: lowercase;
}

.colophon-rights {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

/* =========================================================================
   Fade-in / Blur-focus animation
   ========================================================================= */
.fade-in {
    opacity: 0.5;
    filter: blur(8px);
    transition: opacity 0.6s ease-out, filter 0.6s ease-out;
    will-change: opacity, filter;
}

.fade-in.is-focused {
    opacity: 1;
    filter: blur(0);
}

/* =========================================================================
   Footnote Slide-Out Panel
   ========================================================================= */
.footnote-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 90vw;
    height: 100vh;
    background: #FFFFFF;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.footnote-panel.is-open {
    transform: translateX(0);
}

.footnote-panel__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 40px 32px 32px;
}

.footnote-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(122, 107, 138, 0.25);
    margin-bottom: 24px;
}

.footnote-panel__ref {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--color-accent);
    text-transform: uppercase;
}

.footnote-panel__close {
    background: transparent;
    border: 1px solid rgba(122, 107, 138, 0.3);
    padding: 4px 12px 4px 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.footnote-panel__close:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.close-x {
    font-size: 16px;
    line-height: 1;
}

.footnote-panel__body {
    flex: 1;
    overflow-y: auto;
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-primary);
}

.footnote-panel__body p {
    margin: 0 0 1.2em;
}

.footnote-panel__meta {
    padding-top: 20px;
    border-top: 1px solid rgba(122, 107, 138, 0.18);
    margin-top: 16px;
}

.panel-meta-line {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.footnote-panel__scrim {
    position: fixed;
    inset: 0;
    background: rgba(42, 40, 48, 0);
    pointer-events: none;
    transition: background 0.4s ease;
    z-index: 150;
}

.footnote-panel__scrim.is-visible {
    background: rgba(42, 40, 48, 0.15);
    pointer-events: auto;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 900px) {
    .running-header__meta {
        display: none;
    }

    .running-header__inner {
        grid-template-columns: 1fr 2fr;
    }

    .icon-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .masthead__meta {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .pub {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pub__tag {
        justify-self: start;
    }

    .colophon-grid {
        grid-template-columns: 1fr;
    }

    .section__number-bg {
        font-size: 120px;
        left: 8px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 16px;
    }

    .section__inner {
        padding: 0 20px;
    }

    .icon-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .commitment {
        grid-template-columns: 60px 1fr;
        gap: 16px;
    }

    .timeline::before {
        left: 6px;
    }

    .timeline__entry {
        grid-template-columns: 1fr;
        gap: 4px;
        padding-left: 28px;
    }

    .timeline__entry::before {
        left: 0;
        top: 28px;
    }

    .section__number-bg {
        font-size: 90px;
        opacity: 0.25;
    }

    .pullquote {
        padding: 32px 28px 28px;
        font-size: 1.15rem;
    }

    .running-header__brand {
        font-size: 11px;
    }

    .section-title-text {
        font-size: 12px;
    }
}
