:root {
    --ink-strong: #16253a;
    --ink: #22354a;
    --ink-soft: #617182;
    --surface: rgba(255, 251, 244, 0.84);
    --surface-strong: rgba(255, 255, 255, 0.9);
    --surface-muted: #f4ede1;
    --line: rgba(22, 37, 58, 0.12);
    --line-strong: rgba(22, 37, 58, 0.2);
    --accent: #1f6b4f;
    --accent-strong: #174f3c;
    --accent-soft: rgba(31, 107, 79, 0.12);
    --signal: #d98841;
    --signal-soft: rgba(217, 136, 65, 0.14);
    --info: #1f4f82;
    --info-soft: rgba(31, 79, 130, 0.12);
    --success: #267257;
    --success-soft: rgba(38, 114, 87, 0.14);
    --danger: #b44d4d;
    --danger-soft: rgba(180, 77, 77, 0.14);
    --shadow-lg: 0 28px 80px rgba(38, 41, 57, 0.12);
    --shadow-md: 0 18px 45px rgba(38, 41, 57, 0.1);
    --shadow-sm: 0 10px 30px rgba(38, 41, 57, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --max-width: 1320px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: "Avenir Next", "Segoe UI Variable", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(223, 201, 160, 0.4), transparent 28%),
        radial-gradient(circle at 90% 0%, rgba(72, 145, 115, 0.22), transparent 26%),
        linear-gradient(180deg, #f7f1e6 0%, #f4efe7 30%, #f8f4ee 100%);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 78%);
    opacity: 0.32;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(217, 136, 65, 0.35);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 20px;
    top: -48px;
    z-index: 1000;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--ink-strong);
    color: #fff;
}

.skip-link:focus {
    top: 20px;
}

.page-shell {
    position: relative;
    width: min(100%, var(--max-width));
    margin: 0 auto;
    padding: 28px 24px 44px;
}

.ambient {
    position: absolute;
    border-radius: 999px;
    filter: blur(20px);
    opacity: 0.85;
    pointer-events: none;
    animation: drift 12s ease-in-out infinite alternate;
}

.ambient-one {
    width: 280px;
    height: 280px;
    background: rgba(244, 177, 116, 0.24);
    top: 90px;
    right: -80px;
}

.ambient-two {
    width: 220px;
    height: 220px;
    background: rgba(31, 107, 79, 0.16);
    top: 420px;
    left: -80px;
    animation-duration: 15s;
}

.ambient-three {
    width: 180px;
    height: 180px;
    background: rgba(31, 79, 130, 0.12);
    bottom: 160px;
    right: 10%;
    animation-duration: 18s;
}

.site-header,
.module,
.hero-card,
.site-footer {
    position: relative;
    z-index: 1;
}

.masthead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
}

.brand-block {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background:
        linear-gradient(160deg, rgba(31, 107, 79, 0.96), rgba(24, 53, 43, 0.98)),
        linear-gradient(135deg, rgba(255, 255, 255, 0.26), transparent);
    color: #f9f3e9;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: var(--shadow-sm);
}

.brand-copy h1,
.hero-card h2,
.section-header h3,
.subsection-title {
    font-family: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    color: var(--ink-strong);
    letter-spacing: -0.025em;
}

.brand-copy h1 {
    font-size: clamp(2.2rem, 5vw, 3.3rem);
    line-height: 0.96;
    margin-bottom: 10px;
}

.eyebrow,
.section-label {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.74rem;
    color: var(--ink-soft);
    font-weight: 700;
}

.brand-summary {
    max-width: 720px;
    color: var(--ink-soft);
    font-size: 1rem;
}

.masthead-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.market-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink-strong);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.market-pill::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.75;
}

.market-pill.open {
    color: var(--success);
    background: rgba(234, 249, 240, 0.95);
}

.market-pill.closed {
    color: var(--danger);
    background: rgba(254, 241, 241, 0.95);
}

.loading-pill {
    color: var(--ink-soft);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.95fr);
    gap: 20px;
    align-items: stretch;
}

.intro-card {
    grid-row: span 2;
    min-height: 100%;
}

.hero-card,
.module,
.site-footer {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 251, 244, 0.75)),
        rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-lg);
}

.hero-card,
.module {
    padding: 24px;
    animation: float-in 700ms ease both;
}

.hero-card:nth-child(2),
.module:nth-child(2) {
    animation-delay: 80ms;
}

.hero-card:nth-child(3),
.module:nth-child(3) {
    animation-delay: 140ms;
}

.hero-card h2 {
    font-size: clamp(2.2rem, 4vw, 3.1rem);
    line-height: 1.03;
    margin: 10px 0 16px;
    max-width: 12ch;
}

.lede {
    max-width: 56ch;
    color: var(--ink-soft);
    font-size: 1.05rem;
}

.hero-actions,
.signal-row,
.workspace-tabs,
.segmented-control,
.action-form,
.manufacturer-actions,
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-actions {
    margin-top: 28px;
}

.signal-row {
    margin-top: 22px;
}

.signal-chip,
.result-chip,
.mini-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--ink-strong);
}

.signal-chip {
    background: rgba(249, 243, 234, 0.85);
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.section-header h3 {
    font-size: 1.65rem;
    line-height: 1.05;
    margin-top: 8px;
}

.status-note {
    max-width: 240px;
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-align: right;
}

.principles-grid,
.overview-grid,
.detail-grid,
.intel-grid {
    display: grid;
    gap: 14px;
}

.principles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.principle-card,
.metric-card,
.detail-card,
.rule-card,
.stack-item,
.manufacturer-card,
.intel-card,
.timeline-item,
.result-block {
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.principle-card {
    padding: 16px;
}

.principle-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.principle-copy {
    color: var(--ink);
    font-size: 0.94rem;
}

.overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card {
    padding: 16px;
}

.metric-wide {
    grid-column: span 2;
}

.metric-label,
.detail-label,
.rule-meta,
.timeline-date,
.stack-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-soft);
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin: 12px 0 6px;
    font-size: 1.55rem;
    line-height: 1.05;
    color: var(--ink-strong);
}

.metric-note,
.detail-note,
.stack-copy,
.timeline-copy,
.result-note,
.empty-state p {
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.main-content {
    margin-top: 26px;
}

.workspace-tabs {
    margin-bottom: 18px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.8);
    width: fit-content;
    box-shadow: var(--shadow-sm);
}

.workspace-tab,
.segment-button,
.button {
    border: 0;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.workspace-tab {
    padding: 12px 18px;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-weight: 700;
}

.workspace-tab.active {
    background: linear-gradient(135deg, rgba(31, 107, 79, 0.95), rgba(24, 53, 43, 0.95));
    color: #fff8ee;
    box-shadow: 0 10px 24px rgba(24, 53, 43, 0.22);
}

.workspace-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.module-feature {
    background:
        linear-gradient(180deg, rgba(255, 249, 239, 0.92), rgba(255, 255, 255, 0.82)),
        rgba(255, 255, 255, 0.72);
}

.subsection-title {
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.action-form input {
    flex: 1 1 230px;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink-strong);
}

.action-form input::placeholder {
    color: rgba(97, 113, 130, 0.8);
}

.button {
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.button:hover,
.workspace-tab:hover,
.segment-button:hover {
    transform: translateY(-1px);
}

.button:disabled,
.inline-action:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.primary-button {
    background: linear-gradient(135deg, #1f6b4f, #18352b);
    color: #fff8ee;
    box-shadow: 0 14px 26px rgba(24, 53, 43, 0.2);
}

.secondary-button {
    background: linear-gradient(135deg, #d98841, #bf6f2a);
    color: #fff8ee;
    box-shadow: 0 14px 26px rgba(191, 111, 42, 0.18);
}

.ghost-button {
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink-strong);
    border: 1px solid var(--line);
}

.segmented-control {
    padding: 6px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.62);
    border-radius: 999px;
    width: fit-content;
}

.segment-button {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-weight: 700;
}

.segment-button.active {
    background: rgba(31, 107, 79, 0.14);
    color: var(--accent-strong);
}

.analysis-panel,
.rules-list,
.stack-list,
.manufacturer-grid,
.timeline-list {
    display: grid;
    gap: 12px;
}

.analysis-panel {
    min-height: 250px;
}

.empty-state,
.loading-state {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 200px;
    padding: 28px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.55);
}

.empty-state strong,
.loading-state strong {
    font-size: 1rem;
    color: var(--ink-strong);
}

.result-block {
    padding: 18px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.result-title {
    font-family: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    font-size: 1.5rem;
    color: var(--ink-strong);
}

.result-chip.success {
    background: var(--success-soft);
    color: var(--success);
}

.result-chip.warning {
    background: var(--signal-soft);
    color: #99551f;
}

.result-chip.info {
    background: var(--info-soft);
    color: var(--info);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.detail-card {
    padding: 16px;
}

.detail-value {
    display: block;
    margin: 10px 0 6px;
    color: var(--ink-strong);
    font-size: 1.15rem;
    font-weight: 800;
}

.rules-list {
    max-height: 620px;
    overflow: auto;
    padding-right: 4px;
}

.rule-card {
    padding: 18px;
}

.rule-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.rule-title {
    margin: 8px 0 6px;
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--ink-strong);
}

.rule-description {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.mini-chip.green {
    background: rgba(38, 114, 87, 0.12);
    color: var(--success);
}

.mini-chip.red {
    background: rgba(180, 77, 77, 0.12);
    color: var(--danger);
}

.mini-chip.amber {
    background: rgba(217, 136, 65, 0.12);
    color: #99551f;
}

.subrule-list {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.subrule-item {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(244, 237, 225, 0.78);
    color: var(--ink);
    font-size: 0.9rem;
}

.stack-item,
.timeline-item,
.manufacturer-card {
    padding: 16px;
}

.stack-item,
.manufacturer-card {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.stack-main,
.timeline-main {
    min-width: 0;
}

.stack-title,
.manufacturer-name,
.campaign-title,
.timeline-title {
    color: var(--ink-strong);
    font-size: 1rem;
    font-weight: 800;
}

.stack-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-action {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink-strong);
    cursor: pointer;
    font-weight: 700;
}

.inline-action:hover {
    background: rgba(244, 237, 225, 0.95);
}

.manufacturer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manufacturer-meta {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.manufacturer-actions {
    justify-content: flex-end;
}

.intel-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.intel-card {
    padding: 16px;
}

.intel-card strong {
    display: block;
    margin-bottom: 8px;
    color: var(--ink-strong);
}

.timeline-list {
    max-height: 620px;
    overflow: auto;
    padding-right: 4px;
}

.timeline-item {
    display: grid;
    gap: 6px;
}

.timeline-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.feedback-banner {
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    color: var(--ink);
}

.feedback-banner.success {
    background: rgba(234, 249, 240, 0.9);
    color: var(--success);
}

.feedback-banner.neutral {
    background: rgba(246, 242, 235, 0.92);
    color: var(--ink);
}

.feedback-banner.error {
    background: rgba(254, 241, 241, 0.9);
    color: var(--danger);
}

.activity-strip {
    margin-top: 18px;
}

.site-footer {
    margin-top: 20px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.footer-copy {
    max-width: 760px;
    color: var(--ink-soft);
    display: grid;
    gap: 8px;
}

.footer-links {
    justify-content: flex-end;
}

.footer-links a {
    font-weight: 700;
}

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

.neutral {
    color: var(--ink-soft);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: rgba(97, 113, 130, 0.28);
    border-radius: 999px;
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(16px, -14px, 0) scale(1.05);
    }
}

@keyframes float-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1120px) {
    .hero-grid,
    .workspace-grid,
    .intel-layout {
        grid-template-columns: 1fr;
    }

    .intro-card {
        grid-row: auto;
    }

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

    .site-footer {
        flex-direction: column;
    }

    .footer-links {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .page-shell {
        padding: 18px 16px 28px;
    }

    .masthead,
    .section-header,
    .stack-item,
    .manufacturer-card,
    .timeline-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .masthead-actions,
    .manufacturer-actions,
    .stack-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .brand-mark {
        width: 60px;
        height: 60px;
        border-radius: 18px;
    }

    .hero-card,
    .module,
    .site-footer {
        padding: 18px;
        border-radius: 22px;
    }

    .principles-grid,
    .overview-grid,
    .detail-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .metric-wide {
        grid-column: auto;
    }

    .action-form {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        width: 100%;
    }

    .workspace-tabs {
        width: 100%;
    }

    .workspace-tab {
        flex: 1 1 0;
        justify-content: center;
    }

    .status-note {
        max-width: none;
        text-align: left;
    }

    .hero-card h2 {
        max-width: none;
    }
}
