/* ==========================================================================
   FABRICA.vc - Core styles
   ========================================================================== */

:root {
    --bg-clean: #FAFBF9;
    --graphite: #1E2220;
    --calacatta-dark: #0B251A;
    --calacatta-accent: #1E5E43;
    --paper: #FFFFFF;
    --muted: #676B65;
    --line: #E3E5DF;
    --rust: #A35434;
    --soft: #F3F5F0;
    --stone-line: rgba(214, 211, 209, 0.6);
    --overlay-deep: rgba(11, 37, 26, 0.8);
    --shadow-modal: 0 40px 80px rgba(0, 0, 0, 0.15);
    --shadow-soft: 0 18px 48px rgba(11, 37, 26, 0.10);
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-clean);
    color: var(--graphite);
    font-family: "DM Sans", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

/* Typography helpers */
.mono {
    font-family: "JetBrains Mono", monospace;
}

.serif {
    font-family: "DM Sans", sans-serif;
}

.montserrat {
    font-family: "DM Sans", sans-serif;
}

/* Public identity shell */
.public-topbar {
    position: relative;
    z-index: 40;
    display: flex;
    width: min(1160px, calc(100% - 32px));
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-inline: auto;
    padding: 1.2rem 0;
    border-bottom: 1px solid rgba(30, 34, 32, 0.08);
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--graphite);
    font-size: clamp(1.35rem, 4vw, 1.9rem);
    letter-spacing: 0.01em;
    text-decoration: none;
}

.public-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.public-brand strong {
    font-weight: 900;
}

.public-brand span {
    color: var(--calacatta-accent);
}

.public-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.public-nav a {
    color: inherit;
    text-decoration: none;
    transition: color 180ms ease;
}

.public-nav a:hover {
    color: var(--calacatta-accent);
}

.public-hero {
    width: min(1160px, calc(100% - 32px));
    margin-inline: auto;
    padding: clamp(4rem, 10vw, 7.6rem) 0 clamp(3.5rem, 8vw, 5.5rem);
}

.public-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.35rem;
    color: var(--calacatta-accent);
    font: 900 0.68rem/1.2 "JetBrains Mono", ui-monospace, monospace;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.public-eyebrow::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--calacatta-accent);
    box-shadow: 0 0 0 6px rgba(30, 94, 67, 0.08);
}

.public-heading {
    max-width: 980px;
    margin: 0;
    color: var(--graphite);
    font-size: clamp(2.75rem, 8vw, 6.8rem);
    font-weight: 900;
    line-height: 0.96;
    letter-spacing: -0.06em;
}

.public-heading span {
    color: var(--calacatta-accent);
}

.public-lead {
    max-width: 720px;
    margin: 1.35rem 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.22rem);
    font-weight: 400;
    line-height: 1.62;
}

.public-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.7rem;
}

.public-button {
    display: inline-flex;
    min-height: 3.25rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--paper);
    padding: 0 1.15rem;
    color: var(--graphite);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.public-button:hover {
    border-color: rgba(30, 94, 67, 0.24);
    transform: translateY(-1px);
}

.public-button--primary {
    border-color: var(--rust);
    background: var(--rust);
    color: #FFFFFF;
    box-shadow: 0 16px 34px rgba(163, 84, 52, 0.20);
}

.public-card {
    border: 1px solid rgba(30, 34, 32, 0.09);
    border-radius: 1.15rem;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow-soft);
}

.public-card--dark {
    border-color: rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 760px) {
    .public-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-nav {
        justify-content: flex-start;
        row-gap: 0.7rem;
    }

    .public-hero {
        padding-top: 3.6rem;
    }

    .public-heading {
        font-size: clamp(2.45rem, 12.2vw, 4.2rem);
        line-height: 0.98;
        letter-spacing: -0.025em;
    }

    .public-actions {
        flex-direction: column;
    }

    .public-button {
        width: 100%;
    }
}

/* Base background */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(rgba(30, 94, 67, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Motion */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: opacity, transform;
}

.fade-delay-100 {
    animation-delay: 0.1s;
}

.fade-delay-200 {
    animation-delay: 0.2s;
}

.fade-delay-300 {
    animation-delay: 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in {
        opacity: 1;
        transform: none;
        will-change: auto;
    }
}

/* Modal system */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--overlay-deep);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay:focus {
    outline: none;
}

.modal-panel,
.modal-content {
    background: #FFFFFF;
    width: min(90vw, 440px);
    max-height: 85vh;
    border-top: 4px solid var(--graphite);
    box-shadow: var(--shadow-modal);
}

.modal-content {
    padding: 3rem;
}

/* Scrollbar for legal text areas */
.custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 37, 26, 0.18) transparent;
}

.custom-scroll::-webkit-scrollbar {
    width: 5px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(11, 37, 26, 0.16);
    border-radius: 10px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(11, 37, 26, 0.28);
}

/* Focus visibility */
:where(a, button, iframe, [tabindex]):focus-visible {
    outline: 2px solid var(--calacatta-accent);
    outline-offset: 4px;
}

.modal-overlay :where(button):focus-visible {
    outline-offset: 3px;
}

/* Modal dialog (home + institutional pages) */
.modal-dialog {
    display: flex;
    flex-direction: column;
    width: min(92vw, 56rem);
    max-height: 85vh;
    background: #fff;
    box-shadow: var(--shadow-modal);
    border-top: 4px solid var(--calacatta-accent);
}

.modal-dialog--wide {
    width: min(92vw, 64rem);
}

.modal-dialog--neutral {
    border-top-color: var(--graphite);
}

.modal-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    border-bottom: 1px solid var(--line);
    background: var(--soft);
    flex-shrink: 0;
}

.modal-dialog__title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--graphite);
}

.modal-dialog__title .accent {
    color: var(--calacatta-accent);
}

.modal-dialog__close {
    border: 0;
    background: none;
    font-size: 1.35rem;
    line-height: 1;
    color: #c4c7c0;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 180ms ease;
}

.modal-dialog__close:hover {
    color: #b4452f;
}

.modal-dialog__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #fff;
}

.modal-dialog__body--iframe {
    background: var(--soft);
}

.modal-dialog__body--iframe iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 60vh;
    border: 0;
}

.modal-dialog__body--scroll {
    padding: 2rem 2.5rem;
    color: var(--muted);
    font-size: 0.875rem;
    line-height: 1.65;
}

.modal-dialog__body--scroll h2 {
    margin: 1.5rem 0 0.75rem;
    color: var(--graphite);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-dialog__body--scroll h2:first-of-type {
    margin-top: 0;
}

.modal-dialog__body--scroll p {
    margin: 0 0 1rem;
}

.modal-dialog__label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--calacatta-accent);
    margin-bottom: 1rem;
}

.modal-dialog__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.35rem;
    border-top: 1px solid var(--line);
    background: var(--soft);
    flex-shrink: 0;
}

.modal-dialog__meta {
    margin-right: auto;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.modal-dialog__action {
    border: 0;
    background: var(--graphite);
    color: #fff;
    padding: 0.65rem 1.35rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 180ms ease;
}

.modal-dialog__action:hover {
    background: var(--calacatta-accent);
}
