/* ══════════════════════════════════════════════
   DARKGROUND COFFEE — header-loop.css
   Standalone stylesheet for header-loop.html
   Includes all base styles + header styles
   DevPanicZone | vanilla CSS, no dependencies
   ══════════════════════════════════════════════ */

/* ==== FONTS ==== */

@font-face {
    font-family: 'Bebas';
    src: url('../fonts/bebas-neue-regular.woff2') format('woff2'),
        url('../fonts/bebas-neue-regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ==== CUSTOM PROPERTIES ==== */

:root {
    --display-font: 'Bebas', 'Arial Narrow', Arial, sans-serif;
    --body-font: system-ui, -apple-system, sans-serif;

    --creme: #f2e9d0;
    --karamell: #c8a96e;
    --espresso: #3d1f0d;

    --light: var(--creme);
    --dark: var(--espresso);
    --muted: var(--karamell);

    --opacity-muted: 0.5;

    /* Hero colors — switched per loop by JS */
    --hero-bg: var(--espresso);
    --hero-color: var(--creme);

    --header-height: 60px;
    --footer-height: 40px;
}

/* ==== RESET / BASE ==== */

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

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--body-font);
    background: var(--espresso);
    color: var(--creme);
    padding-bottom: var(--footer-height);
    /* space for fixed footer */
}

h1,
h2 {
    font-family: var(--display-font);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin: 0;
}

h1 {
    font-size: clamp(4rem, 24vw, 24rem);
    line-height: 1;
}

h2 {
    font-size: clamp(3rem, 14vw, 10rem);
    line-height: 1;
}

p {
    margin: 0;
}

/* ==== UTILITIES ==== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ==== HEADER ==== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: var(--header-height);
    background: #1a0c05;
    border-bottom: 1px solid rgba(242, 233, 208, 0.07);
    color: #f2e9d0;
}

/* Brand link */
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: inherit;
    font-family: var(--display-font);
    font-size: clamp(1.2rem, 2vw, 1.4rem);
    letter-spacing: 0.08em;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.header-brand:hover {
    opacity: 1;
}

.header-logo {
    height: 22px;
    width: auto;
    flex-shrink: 0;
    transform: translateY(-2px);
}

/* Desktop nav */
.header-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-nav a {
    font-family: var(--display-font);
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    letter-spacing: 0.08em;
    color: inherit;
    text-decoration: none;
    opacity: 0.55;
    transition: opacity 0.2s;
}

.header-nav a:hover {
    opacity: 1;
}

.header-nav a.is-active {
    opacity: 1;
    /* border-bottom: 1px solid currentColor; */
}

/* Hamburger button */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #f2e9d0;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger → X when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Offset main content so header doesn't overlap */
#main-content {
    padding-top: var(--header-height);
}

/* Hero fills remaining viewport height */
.hero {
    height: calc(100vh - var(--header-height));
}

/* ==== HERO ==== */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--hero-bg);
    color: var(--hero-color);
    transition: background 0.8s ease, color 0.8s ease;
}

.hero-title {
    font-family: var(--display-font);
    font-size: clamp(0.9rem, 2.5vw, 1.4rem);
    letter-spacing: 0.15em;
    opacity: 1;
    font-weight: 400;
    margin: 0;
}

.hero-brand {
    font-family: var(--display-font);
    font-size: clamp(4rem, 20vw, 16rem);
    line-height: 1;
    /* text-transform: uppercase; */
    letter-spacing: 0.03em;
    user-select: none;
    white-space: nowrap;
    opacity: 0.65;
}

.hero-center {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.hero-svg {
    width: clamp(60px, 6vw, 80px);
    height: clamp(156px, 15.6vw, 208px);
    overflow: visible;
}

.hero-tagline {
    font-family: var(--display-font);
    font-size: clamp(0.9rem, 2.5vw, 1.6rem);
    letter-spacing: 0.2em;
    /* text-transform: uppercase; */
    opacity: 0.8;
}

/* ==== SECTIONS ==== */

.section {
    width: 100%;
    padding: 5rem 2rem;
    position: relative;
}

.section-full {
    width: 100%;
    position: relative;
}

.section--dark {
    background: var(--espresso);
    color: var(--creme);
}

.section--mid {
    background: #2a1208;
    color: var(--creme);
}

.section--accent {
    background: var(--karamell);
    color: var(--espresso);
}

.section--overflow-hidden {
    overflow: hidden;
}

.section-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.section-inner--pad-top {
    padding-top: 3rem;
}

/* ==== BODY TEXT ==== */

.body-text {
    font-size: 1.1rem;
    line-height: 1.85;
    max-width: 60ch;
    opacity: 0.8;
}

.body-text--center {
    text-align: center;
    margin: 0 auto;
}

/* ==== SPLIT LAYOUT ==== */

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100%;
}

.split-layout .section-inner {
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2.5rem;
}

.split-media {
    overflow: hidden;
}

.split-media img,
.split-media video,
.split-media svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Modifier: image right, text left */
.split-layout--reverse .split-media {
    order: 1;
}

.split-layout--reverse .section-inner {
    order: 0;
}

@media (max-width: 768px) {
    .split-layout {
        grid-template-columns: 1fr;
    }

    .split-media {
        height: 40vh;
        order: 0 !important;
    }

    .split-layout .section-inner {
        order: 1 !important;
    }
}

/* ==== REVEAL ON SCROLL ==== */

.reveal {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal:nth-child(2) {
    transition-delay: 0.15s;
}

.reveal:nth-child(3) {
    transition-delay: 0.3s;
}

/* ==== TICKER ==== */

.ticker-wrap {
    overflow: hidden;
    width: 100%;
}

.ticker {
    display: flex;
    width: max-content;
    white-space: nowrap;
    animation: ticker 90s linear infinite;
}

.ticker-group {
    display: flex;
    flex-shrink: 0;
}

.ticker-item {
    font-family: var(--display-font);
    font-size: clamp(3rem, 16vw, 12rem);
    line-height: 1;
    text-transform: uppercase;
    padding-right: 2rem;
    flex-shrink: 0;
}

.ticker-item.sep {
    opacity: 0.6;
}

@keyframes ticker {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* ==== STAGGER WORDS ==== */

.stagger-sequence {
    text-align: center;
    font-family: var(--display-font);
    text-transform: uppercase;
    line-height: 1;
}

.stagger-item {
    display: block;
    font-size: clamp(2.5rem, 12vw, 10rem);
    opacity: 0;
    transform: translateY(24px);
}

.stagger-item.is-visible {
    animation: wordPop 0.5s ease forwards;
}

.stagger-item.is-visible:nth-child(1) {
    animation-delay: 0.0s;
}

.stagger-item.is-visible:nth-child(2) {
    animation-delay: 0.3s;
}

.stagger-item.is-visible:nth-child(3) {
    animation-delay: 0.6s;
}

.stagger-item.is-visible:nth-child(4) {
    animation-delay: 0.9s;
}

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

/* ==== SLIDE-IN ==== */

.slide-in-wrap {
    display: flex;
    flex-direction: column;
    font-family: var(--display-font);
    font-size: clamp(2.5rem, 10vw, 8rem);
    text-transform: uppercase;
    line-height: 1.1;
}

.slide-in-left,
.slide-in-right {
    opacity: 0;
}

.slide-in-left.is-visible {
    animation: fromLeft 0.9s ease forwards;
}

.slide-in-right.is-visible {
    animation: fromRight 0.9s ease forwards;
}

.slide-in-left.is-visible:nth-child(1) {
    animation-delay: 0.0s;
}

.slide-in-right.is-visible:nth-child(2) {
    animation-delay: 0.25s;
}

.slide-in-left.is-visible:nth-child(3) {
    animation-delay: 0.5s;
}

.slide-in-right.is-visible:nth-child(4) {
    animation-delay: 0.75s;
}

@keyframes fromLeft {
    from {
        opacity: 0;
        transform: translateX(-100vw);
    }

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

@keyframes fromRight {
    from {
        opacity: 0;
        transform: translateX(100vw);
    }

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

/* ==== TYPEWRITER ==== */

.typewriter-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.typewriter {
    font-family: var(--display-font);
    font-size: clamp(2.5rem, 10vw, 8rem);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    width: 0;
    opacity: 1;
}

.tw-1 {
    --tw-chars: 8;
    --tw-delay: 0s;
    --tw-duration: 1.6s;
}

.tw-2 {
    --tw-chars: 13;
    --tw-delay: 1.6s;
    --tw-duration: 2.0s;
}

.tw-3 {
    --tw-chars: 9;
    --tw-delay: 3.6s;
    --tw-duration: 1.6s;
}

.typewriter.is-visible {
    animation: typing var(--tw-duration) steps(var(--tw-chars)) var(--tw-delay) forwards;
}

@keyframes typing {
    to {
        width: calc(var(--tw-chars) * 1ch);
    }
}

/* ==== IMG GRID ==== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.gallery-grid img {
    width: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* ==== COFFEE GRID ==== */

.coffee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.coffee-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.coffee-card h3 {
    font-family: var(--display-font);
    margin-top: 1rem;
}

/* ==== TEAM GRID ==== */

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    text-align: center;
}

.team-member img {
    width: 100%;
    object-fit: cover;
}

/* ==== CONTACT ==== */

.reveal-sequence--contact {
    position: relative;
    height: 1em;
    font-family: var(--display-font);
    font-size: clamp(2.5rem, 10vw, 8rem);
    text-transform: uppercase;
    line-height: 1;
}

.reveal-fade {
    position: absolute;
    left: 0;
    opacity: 0;
    white-space: nowrap;
}

.reveal-fade-full {
    position: absolute;
    left: 0;
    opacity: 0;
    white-space: nowrap;
    font-family: var(--display-font);
    font-size: clamp(2.5rem, 6vw, 4rem);
    text-transform: uppercase;
    line-height: 1;
}

.is-visible .reveal-fade:nth-child(1) {
    animation: wordSoft 1.2s ease 0.0s forwards;
}

.is-visible .reveal-fade:nth-child(2) {
    animation: wordSoft 1.2s ease 1.3s forwards;
}

.is-visible .reveal-fade:nth-child(3) {
    animation: wordSoft 1.2s ease 2.6s forwards;
}

.is-visible .reveal-fade-full {
    animation: wordFinal 1.0s ease 3.9s forwards;
}

@keyframes wordSoft {
    0% {
        opacity: 0;
    }

    30% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes wordFinal {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2rem;
    opacity: 0;
}

.is-visible .contact-info {
    animation: wordFinal 0.6s ease 3.3s forwards;
}

.contact-info a {
    font-size: 1rem;
    color: inherit;
    text-decoration: none;
    opacity: 0.85;
    letter-spacing: 0.05em;
    transition: opacity 0.2s;
}

.contact-info p {
    opacity: 0.8;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.contact-info a:hover {
    opacity: 1;
}

/* ==== FOOTER ==== */

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.6rem 1rem;
    background: rgba(61, 31, 13, 0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(242, 233, 208, 0.08);
    font-size: 0.75rem;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer a {
    color: var(--creme);
    text-decoration: none;
    opacity: 0.75;
    transition: opacity 0.2s;
}

.footer a:hover {
    opacity: 1;
}

/* ==== REDUCED MOTION ==== */

@media (prefers-reduced-motion: reduce) {

    .ticker,
    .stagger-item,
    .slide-in-left,
    .slide-in-right,
    .typewriter {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
        width: auto !important;
    }
}

/* ==== MEDIA QUERIES ==== */

@media screen and (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .header-nav {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: #1a0c05;
        border-bottom: 1px solid rgba(242, 233, 208, 0.07);
        padding: 1rem 2rem;
    }

    .header-nav.is-open {
        display: flex;
    }

    .header-nav a {
        padding: 0.6rem 0;
        font-size: 1.1rem;
        opacity: 0.6;
        width: 100%;
        border-bottom: 1px solid rgba(242, 233, 208, 0.05);
    }

    .header-nav a:last-child {
        border-bottom: none;
    }
}

@media screen and (max-width: 576px) {

    :root {
        --footer-height: 80px;
    }

    .body-text {
        font-size: 1rem;
    }

    .footer-nav {
        align-items: center;
        justify-content: center;
        gap: 1rem;
    }
}