/* --- Base --- */

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

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    color: #0b0b10;
    background-color: #050508;
    overflow-x: hidden;
    overflow-y: auto;
}

/* --- Background --- */

.hero-background {
    position: fixed;
    inset: 0;
    background-image: url("/assets/CeridwenCoverAbstract.png");
    background-size: cover;
    background-position: center;
    transform: scale(1.08);
    --parallax-x: 0px;
    --parallax-y: 0px;
    animation: heroDrift 42s ease-in-out infinite alternate;
    z-index: -2;
}

.hero-overlay {
    position: fixed;
    inset: 0;
    /* Light center, slightly darker edges for legibility */
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.85) 40%, rgba(230, 230, 230, 0.9) 75%, rgba(210, 210, 210, 0.95)),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.9));
    z-index: -1;
}

@keyframes heroDrift {
    0% {
        transform: scale(1.08) translate3d(var(--parallax-x, 0px), var(--parallax-y, 0px), 0);
    }
    100% {
        transform: scale(1.11) translate3d(var(--parallax-x, 0px), calc(-12px + var(--parallax-y, 0px)), 0);
    }
}

/* --- Layout --- */

.landing {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2.5rem;
}

/* --- Brand lockup --- */

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 40rem;
}

.landing .brand-lockup {
    flex-direction: column;
    text-align: center;
    margin-inline: auto;
}

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

.brand-text h1 {
    margin: 0;
    font-size: 1.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-kicker {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.7;
}

.brand-tagline {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

/* --- Hero content --- */

.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.hero-subtitle {
    margin: 0;
    font-size: 0.9rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0.7;
}

.hero-choices {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 56rem;
    margin-top: 0.5rem;
}

/* --- Path cards --- */

.path-card {
    position: relative;
    display: block;
    padding: 1.75rem 1.9rem;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 1.2rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transform: translateY(20px);
    opacity: 0;
    animation: cardIn 700ms ease forwards;
}

.path-card--left {
    animation-delay: 320ms;
}

.path-card--right {
    animation-delay: 460ms;
}

.path-card--center {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc((100% - 1.5rem) / 2);
    animation-delay: 600ms;
}

.path-card--inverted {
    background: rgba(10, 10, 15, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.path-card--inverted:focus-visible {
    outline-color: #fff;
}

.path-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.path-card p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.9;
}

.path-card::after {
    content: "↦";
    position: absolute;
    right: 1.4rem;
    bottom: 1.4rem;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: transform 220ms ease, opacity 220ms ease;
}

.path-card:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 3px;
}

.path-card:hover {
    transform: translateY(14px);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.16);
}

.path-card:hover::after {
    transform: translateX(3px);
    opacity: 1;
}

@keyframes cardIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Video overlay --- */

.video-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 400ms ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.video-backdrop {
    position: absolute;
    inset: 0;
    background-color: #000;
}

.intro-video {
    position: relative;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 700ms ease;
}

.video-overlay.show-video .intro-video {
    opacity: 1;
}

.skip-intro {
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    padding: 0.35rem 0.9rem;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(15, 23, 42, 0.82);
    color: #f9fafb;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    cursor: pointer;
}

/* --- Responsive --- */

@media (max-width: 800px) {
    .landing {
        padding: 1.2rem 1.2rem 1.6rem;
    }

    .brand-lockup {
        flex-direction: row;
        align-items: center;
        gap: 0.9rem;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
    }

    .hero-choices {
        grid-template-columns: minmax(0, 1fr);
    }

    .path-card--center {
        width: 100%;
    }

    .path-card {
        padding: 1.4rem 1.5rem;
    }

    .skip-intro {
        right: 1rem;
        bottom: 1rem;
    }
}
/* --- Modals --- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.modal-backdrop[hidden] {
    display: none !important;
}

.modal-backdrop[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 480px;
    background: var(--ceridwen-glass-bg, rgba(255, 255, 255, 0.9));
    border-radius: 1.2rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transform: translateY(10px) scale(0.95);
    transition: transform 300ms ease;
}

.modal-content[hidden] {
    display: none !important;
}

.modal-backdrop[aria-hidden="false"] .modal-content {
    transform: translateY(0) scale(1);
}

.modal-content h2 {
    margin: 0;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-content p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: #4b5563;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 0.5rem;
    border-radius: 999px;
    transition: background-color 150ms ease, color 150ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #111827;
}

.modal-proceed {
    margin-top: 1rem;
    align-self: flex-start;
}

/* Pricing List inside Modal */
.pricing-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
    width: 100%;
}

.pricing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
}

.pricing-plan {
    font-weight: 600;
    font-size: 0.95rem;
    color: #111827;
}

.pricing-cost {
    font-family: var(--font-mono, monospace);
    font-size: 0.95rem;
    color: #4b5563;
}

.pricing-cost small {
    font-size: 0.75rem;
    color: #9ca3af;
}

.modal-note {
    font-size: 0.9rem !important;
    font-style: italic;
    color: #6b7280 !important;
}

/* Ensure responsiveness for modals on small screens */
@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
}

/* --- Page Transitions --- */

.page-intro-curtain {
    position: fixed;
    inset: 0;
    background-color: #000;
    z-index: 9999;
    pointer-events: none;
    animation: fadeOutCurtain 1.5s ease-out forwards;
}

@keyframes fadeOutCurtain {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Updated transition for video overlay to be more 'film-style' */
/* We override the previous transition if needed, or just rely on class specificity */
.video-overlay {
    transition: opacity 800ms ease !important;
}

/* --- Audio Controller --- */

.audio-control-container {
    position: fixed;
    bottom: 5rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    font-family: var(--font-sans);
}

.audio-toggle-btn {
    background: transparent;
    border: none;
    color: var(--ceridwen-ink);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: transform 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* On dark backgrounds (like the landing), ensure it is visible.
   If the hero background is dark, we might need white.
   styleguide says landing uses CeridwenCoverAbstract which is darkish.
   Let's check variable usage. If landing text is light, this should be light.
   The brand-lockup uses light text on dark overlay usually.
   Let's assume white/light for the button on the landing page.
*/
.landing .audio-toggle-btn {
    color: rgba(255, 255, 255, 0.8);
}

.audio-toggle-btn:hover {
    transform: scale(1.1);
    color: #ffffff;
}

.audio-toggle-btn:focus-visible {
    outline: 2px solid var(--ceridwen-focus);
    outline-offset: 2px;
}

/* Red slash state */
.audio-toggle-btn.is-muted {
    color: var(--ceridwen-danger);
}
.audio-toggle-btn.is-muted:hover {
    color: #ef4444; /* slightly lighter red */
}

/* Popup */
.audio-popup {
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.audio-popup-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.audio-popup-text {
    line-height: 1.4;
}

.audio-popup-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.25rem;
}

.audio-popup-close:hover {
    color: #fff;
}

.audio-popup.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* --- Footer --- */

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 3rem;
    align-items: center;
    padding: 1rem 2rem;
    /* Subtle glassmorphism */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    font-size: 0.85rem;
    color: var(--ceridwen-ink);
}

.site-footer a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-footer a:hover {
    color: var(--ceridwen-accent-soft);
}

.footer-left, .footer-center, .footer-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Dropdown */
.footer-dropdown {
    position: relative;
    cursor: pointer;
}

.footer-dropdown-trigger {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem;
}

.footer-dropdown-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-0.5rem); /* Add gap */
    background: var(--ceridwen-glass-bg);
    border: 1px solid var(--ceridwen-glass-border);
    box-shadow: var(--ceridwen-glass-shadow);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    padding: 0.5rem 0;
}

.footer-dropdown:hover .footer-dropdown-content,
.footer-dropdown-trigger:focus + .footer-dropdown-content,
.footer-dropdown-content:hover,
.footer-dropdown-content:focus-within {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.footer-dropdown-content a {
    padding: 0.75rem 1.2rem;
    display: block;
    width: 100%;
    text-align: center;
}

.footer-dropdown-content a:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Ensure footer works on mobile */
@media (max-width: 600px) {
    .site-footer {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.25rem 1.5rem;
        text-align: center;
    }

    .footer-dropdown-content {
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Page Shell for subpages */
.page-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 6rem; /* Extra bottom padding for footer */
}

/* --- Teaser Overlay --- */

.teaser {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background-image: url("/assets/CeridwenCoverAbstract.png");
    background-size: cover;
    background-position: center;
    animation: heroDrift 42s ease-in-out infinite alternate;
}

.teaser::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.85) 40%, rgba(230, 230, 230, 0.9) 75%, rgba(210, 210, 210, 0.95)),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.9));
    z-index: 0;
}

/* Activate teaser when body has the data attribute */
body[data-teaser="true"] .teaser {
    display: flex;
}

/* Hide main content + footer when teaser is active */
body[data-teaser="true"] .landing,
body[data-teaser="true"] .site-footer,
body[data-teaser="true"] .modal-backdrop,
body[data-teaser="true"] .video-overlay,
body[data-teaser="true"] .audio-control-container {
    display: none !important;
}

.teaser-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 560px;
    width: 90%;
    padding: 3rem 2.5rem;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    border-radius: 1.4rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.12),
        0 1px 3px rgba(0, 0, 0, 0.06);
    opacity: 0;
    transform: translateY(20px);
    animation: cardIn 700ms ease 300ms forwards;
}

.teaser-mark {
    width: 60px;
    height: 60px;
    margin-bottom: 0.75rem;
}

.teaser-kicker {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.teaser-title {
    margin: 0;
    font-size: 1.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.teaser-headline {
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    opacity: 0.85;
}

.teaser-body {
    margin: 0.75rem 0 0;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #4b5563;
    max-width: 38ch;
}

.teaser-form {
    width: 100%;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.teaser-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 0.6rem;
}

.teaser-founder {
    margin: 0 0 0.9rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #111827;
}

.teaser-form-row {
    display: flex;
    gap: 0;
    border-radius: 0.65rem;
    border: 1px solid #d1d5db;
    background: #fff;
    overflow: hidden;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.teaser-form-row:focus-within {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.teaser-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-family: inherit;
    color: #111827;
    outline: none;
}

.teaser-input::placeholder {
    color: #9ca3af;
}

.teaser-submit {
    padding: 0.75rem 1.5rem;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    border: none;
    border-left: 1px solid #d1d5db;
    background: #111827;
    color: #f9fafb;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.teaser-submit:hover {
    background: #020617;
}

.teaser-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.teaser-msg {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    min-height: 1.2em;
    letter-spacing: 0.02em;
}

.teaser-msg--ok {
    color: #047857;
}

.teaser-msg--err {
    color: #b91c1c;
}

.teaser-fine {
    margin: 0.75rem 0 0;
    font-size: 0.7rem;
    opacity: 0.4;
    letter-spacing: 0.06em;
}

.teaser-links {
    margin: 1.25rem 0 0;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.teaser-links a {
    color: inherit;
    opacity: 0.55;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    padding-bottom: 2px;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.teaser-links a:hover,
.teaser-links a:focus-visible {
    opacity: 1;
    border-bottom-color: rgba(255, 255, 255, 0.75);
}

.teaser-hint {
    margin: 0.5rem 0 0;
    min-height: 1em;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #6b7280;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 200ms ease, transform 200ms ease;
    pointer-events: none;
}

.teaser-form:has(.teaser-submit:hover) .teaser-hint,
.teaser-form:has(.teaser-submit:focus-visible) .teaser-hint {
    opacity: 0.7;
    transform: translateY(0);
}

@media (max-width: 600px) {
    .teaser-content {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

    .teaser-form-row {
        flex-direction: column;
        border-radius: 0.65rem;
    }

    .teaser-submit {
        border-left: none;
        border-top: 1px solid #d1d5db;
        padding: 0.85rem 1.5rem;
        border-radius: 0 0 0.65rem 0.65rem;
    }

    .teaser-input {
        border-radius: 0.65rem 0.65rem 0 0;
    }
}
