/* ==========================================================================
   WEDDING FOR THREE — weddingforthree.com
   One stylesheet, two languages: en (LTR, root) and he (RTL, /he/).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts
   -------------------------------------------------------------------------- */

@font-face {
    font-family: 'Nitti Typewriter';
    src: url('../fonts/nittiTypewriter-Normal.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */

:root {
    --bg: #ffffff;
    --bg-alt: #f2f1ee;
    --ink: #0e0e10;
    --ink-soft: #3a3a40;
    --muted: #74747c;
    --accent: #d8201f;
    --accent-lift: #ff4b3e;
    --line: rgba(0, 0, 0, 0.13);
    --line-soft: rgba(0, 0, 0, 0.07);

    --font-display: 'Heebo', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Heebo', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Nitti Typewriter', 'Courier New', Courier, monospace;

    --gutter: clamp(1.25rem, 5vw, 4rem);
    --section-y: clamp(4.5rem, 12vh, 9.5rem);

    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   3. Reset / base
   -------------------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--ink);
    background: #000;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

::selection {
    background: var(--accent);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.container {
    width: 100%;
    max-width: 1040px;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* --------------------------------------------------------------------------
   4. Hero — pinned behind the page
   -------------------------------------------------------------------------- */

.hero {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
    background: #000;
    isolation: isolate;
}

.hero__media {
    position: absolute;
    inset: 0;
    z-index: 0;
    /* The drift animation scales the image past its box; clip it here so it
       can never spill below the scrim that's meant to be covering it. */
    overflow: hidden;
}

.hero__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 34%;
    animation: heroDrift 24s var(--ease) forwards;
}

@keyframes heroDrift {
    from {
        transform: scale(1.07);
    }
    to {
        transform: scale(1);
    }
}

/*
 * Side vignettes. The three characters sit dead centre of the photograph, so
 * the frame stays sharp there and dissolves to black as it travels outward —
 * multi-stop to keep the ramp smooth rather than banded.
 */
.hero__sides {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(to right,
            #000 0%, rgba(0, 0, 0, 0.985) 4%, rgba(0, 0, 0, 0.94) 9%,
            rgba(0, 0, 0, 0.85) 14%, rgba(0, 0, 0, 0.7) 19%, rgba(0, 0, 0, 0.52) 24%,
            rgba(0, 0, 0, 0.34) 29%, rgba(0, 0, 0, 0.19) 34%, rgba(0, 0, 0, 0.08) 39%,
            rgba(0, 0, 0, 0.02) 44%, rgba(0, 0, 0, 0) 49%),
        linear-gradient(to left,
            #000 0%, rgba(0, 0, 0, 0.985) 4%, rgba(0, 0, 0, 0.94) 9%,
            rgba(0, 0, 0, 0.85) 14%, rgba(0, 0, 0, 0.7) 19%, rgba(0, 0, 0, 0.52) 24%,
            rgba(0, 0, 0, 0.34) 29%, rgba(0, 0, 0, 0.19) 34%, rgba(0, 0, 0, 0.08) 39%,
            rgba(0, 0, 0, 0.02) 44%, rgba(0, 0, 0, 0) 49%);
}

.hero__scrim {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(to bottom,
            rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.14) 9%, rgba(0, 0, 0, 0) 20%),
        linear-gradient(to bottom,
            rgba(0, 0, 0, 0) 46%, rgba(0, 0, 0, 0.08) 54%, rgba(0, 0, 0, 0.22) 61%,
            rgba(0, 0, 0, 0.42) 68%, rgba(0, 0, 0, 0.63) 75%, rgba(0, 0, 0, 0.8) 82%,
            rgba(0, 0, 0, 0.92) 88%, rgba(0, 0, 0, 0.98) 94%, #000 100%);
}

/* Film grain — sells the one-sheet, costs one data URI. */
.hero__grain {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background-image: var(--grain);
    opacity: 0.06;
    mix-blend-mode: overlay;
}

.hero__content {
    position: relative;
    z-index: 4;
    width: 100%;
    max-width: 1240px;
    padding-inline: var(--gutter);
    padding-bottom: clamp(3.5rem, 10vh, 7rem);
    text-align: center;
    color: #fff;
}

/* --- Title, treated as a one-sheet -------------------------------------- */

/* Sized to sit under the cast, never across their faces. */
.hero__title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.6rem, 7.6vw, 7.5rem);
    line-height: 0.88;
    letter-spacing: -0.04em;
    text-wrap: balance;
    text-shadow: 0 2px 60px rgba(0, 0, 0, 0.5);
}

html[lang="en"] .hero__title {
    text-transform: uppercase;
}

html[lang="he"] .hero__title {
    letter-spacing: -0.025em;
    line-height: 0.99;
    font-size: clamp(2.7rem, 8vw, 8rem);
}

.hero__byline {
    margin-top: clamp(1.1rem, 2.8vh, 2rem);
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.65vw, 1.05rem);
    letter-spacing: 0.22em;
    color: rgba(255, 255, 255, 0.9);
}

html[lang="en"] .hero__byline {
    text-transform: uppercase;
}

html[lang="he"] .hero__byline {
    letter-spacing: 0.05em;
    font-size: clamp(0.95rem, 2.1vw, 1.3rem);
}

.hero__rule {
    width: clamp(44px, 7vw, 84px);
    height: 3px;
    margin: clamp(1.3rem, 3.2vh, 2.2rem) auto;
    background: var(--accent);
}

.hero__tagline {
    max-width: 36ch;
    margin-inline: auto;
    font-size: clamp(1.02rem, 2.05vw, 1.45rem);
    font-weight: 300;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.88);
    text-wrap: balance;
}

.hero__cue {
    position: absolute;
    z-index: 4;
    bottom: clamp(1rem, 2.6vh, 2rem);
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: clamp(26px, 4.6vh, 44px);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
}

.hero__cue::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 1px;
    height: 40%;
    background: #fff;
    animation: cueTravel 2.6s var(--ease) infinite;
}

@keyframes cueTravel {
    0% { transform: translateY(-110%); opacity: 0; }
    22% { opacity: 1; }
    78% { opacity: 1; }
    100% { transform: translateY(260%); opacity: 0; }
}

/* --------------------------------------------------------------------------
   5. The sheet — white page that rises over the pinned hero.
      Its red top edge is the only seam the transition needs.
   -------------------------------------------------------------------------- */

.sheet {
    position: relative;
    z-index: 5;
    background: var(--bg);
    border-top: 4px solid var(--accent);
    box-shadow: 0 -30px 80px rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------------------
   6. Sections & editorial layout
   -------------------------------------------------------------------------- */

.section {
    padding-block: var(--section-y);
}

.section--alt {
    background: var(--bg-alt);
    border-block: 1px solid var(--line-soft);
}

.section--dark {
    background: #000;
    color: #fff;
}

/* Full-width section title — no label column, no numbering. */
.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--accent);
    margin-bottom: clamp(1.8rem, 4.5vh, 3rem);
}

.section--dark .section-title {
    color: var(--accent-lift);
}

/* --- Prose -------------------------------------------------------------- */

/*
 * The opening paragraph carries the section on its own — set larger and
 * darker so there's a hierarchy without any extra words on the page.
 * Scoped so it outranks `.prose p`.
 */
.prose .prose__open {
    font-size: clamp(1.2rem, 1.9vw, 1.6rem);
    font-weight: 300;
    line-height: 1.58;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.prose p + p {
    margin-top: 1.4em;
}

.prose p {
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
    line-height: 1.82;
    color: var(--ink-soft);
    text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   7. Production — a ruled panel of specs, each with its own mark
   -------------------------------------------------------------------------- */

.specs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line);
}

.spec {
    padding: clamp(1.5rem, 3vw, 2.2rem) clamp(1.1rem, 2.2vw, 1.8rem);
    /* Ruled like a panel: every cell draws its own start/bottom edge, and the
       first column and last row give theirs back. */
    border-inline-start: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.spec:nth-child(3n + 1) {
    border-inline-start: 0;
}

.spec:nth-last-child(-n + 3) {
    border-bottom: 0;
}

.spec__icon {
    display: block;
    width: 26px;
    height: 26px;
    margin-bottom: clamp(0.9rem, 2vh, 1.3rem);
    color: var(--accent);
}

.spec__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

html[lang="en"] .spec__label {
    text-transform: uppercase;
}

html[lang="he"] .spec__label {
    letter-spacing: 0.06em;
    font-size: 0.88rem;
}

.spec__value {
    margin: 0;
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    font-weight: 400;
    color: var(--ink);
    line-height: 1.35;
    text-wrap: balance;
}

/* --------------------------------------------------------------------------
   8. Script excerpt / PDF reader
   -------------------------------------------------------------------------- */

/*
 * Width is driven by viewport height so a whole page fits on screen — the
 * reader shouldn't become its own scroll journey.
 */
.reader {
    position: relative;
    margin-inline: auto;
    max-width: min(700px, max(300px, 62vh));
    margin-top: clamp(1rem, 3vh, 2rem);
}

.reader__frame {
    position: relative;
}

.reader__stage {
    position: relative;
    background: #fff;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.05),
        0 24px 60px -16px rgba(0, 0, 0, 0.35);
    /* Reserved ratio keeps the layout from jumping before the first render. */
    aspect-ratio: 1 / 1.414;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.reader__canvas {
    display: block;
    width: 100%;
    height: auto;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.reader__status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    color: var(--muted);
    background: #fff;
    text-align: center;
    padding: 1.5rem;
}

.reader__status[hidden] {
    display: none;
}

.reader__spinner {
    flex: none;
    width: 15px;
    height: 15px;
    border: 1.5px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/*
 * The page turners stand beside the sheet, level with the middle of the page,
 * so turning a page never means scrolling to find a control.
 */
.reader__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.25s var(--ease), color 0.25s var(--ease),
        border-color 0.25s var(--ease), opacity 0.25s ease;
}

.reader__btn--prev {
    inset-inline-end: calc(100% + clamp(0.75rem, 2.5vw, 2rem));
}

.reader__btn--next {
    inset-inline-start: calc(100% + clamp(0.75rem, 2.5vw, 2rem));
}

.reader__btn:hover:not(:disabled) {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.reader__btn:disabled {
    opacity: 0.25;
    cursor: default;
}

.reader__btn svg {
    width: 16px;
    height: 16px;
}

/* Chevrons follow the reading direction. */
html[dir="rtl"] .reader__btn svg {
    transform: scaleX(-1);
}

.reader__count {
    margin-top: clamp(1rem, 2.4vh, 1.5rem);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    direction: ltr;
}

/* --------------------------------------------------------------------------
   9. Contact
   -------------------------------------------------------------------------- */

/* The address is the call to action, so it carries display weight. */
.contact__link {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.35rem, 4.2vw, 2.75rem);
    letter-spacing: -0.01em;
    color: #fff;
    text-decoration: none;
    padding-bottom: 0.3em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
    word-break: break-word;
    direction: ltr;
}

.contact__link:hover {
    color: var(--accent-lift);
    border-bottom-color: var(--accent-lift);
}

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */

.footer {
    background: #000;
    color: rgba(255, 255, 255, 0.5);
    padding-block: clamp(2rem, 5vh, 3rem);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.1em;
}

html[lang="he"] .footer__inner {
    font-size: 0.86rem;
    letter-spacing: 0.02em;
}

.footer__lang {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.75);
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.footer__lang:hover {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* --------------------------------------------------------------------------
   11. Reveals
   -------------------------------------------------------------------------- */

/* Only hide pre-reveal content when JS is actually running to bring it back. */
.js .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 1s var(--ease), transform 1s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

.js .hero__content > * {
    opacity: 0;
    transform: translateY(20px);
    animation: heroIn 1.15s var(--ease) forwards;
}

.hero__title { animation-delay: 0.15s; }
.hero__byline { animation-delay: 0.4s; }
.hero__rule { animation-delay: 0.52s; }
.hero__tagline { animation-delay: 0.64s; }

@keyframes heroIn {
    to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   12. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
    /*
     * No room to stand the turners beside the page, so they float in the
     * page's bottom corners — over margin, never over type, and still
     * reachable without scrolling.
     */
    .reader__btn {
        top: auto;
        bottom: 0.85rem;
        transform: none;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.88);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        border-color: rgba(0, 0, 0, 0.16);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    }

    .reader__btn--prev {
        inset-inline-end: auto;
        inset-inline-start: 0.85rem;
    }

    .reader__btn--next {
        inset-inline-start: auto;
        inset-inline-end: 0.85rem;
    }

    .reader__btn:disabled {
        opacity: 0.35;
    }
}

@media (max-width: 768px) {
    /*
     * Portrait is far too narrow to hold the trio if the photograph fills the
     * whole screen — the two men get cropped straight out of frame. So on
     * phones the image becomes a band across the top, sized to keep all three
     * in shot, and the title block sits beneath it on black. Which is how a
     * poster is laid out anyway.
     */
    .hero__media,
    .hero__sides,
    .hero__scrim,
    .hero__grain {
        inset: 0 0 auto 0;
        height: 58%;
    }

    /*
     * Portrait crops the frame hard, so the side fades pull back — here they
     * only need to soften the edges, not travel in from the centre.
     */
    .hero__sides {
        background:
            linear-gradient(to right,
                #000 0%, rgba(0, 0, 0, 0.9) 3%, rgba(0, 0, 0, 0.62) 7%,
                rgba(0, 0, 0, 0.32) 12%, rgba(0, 0, 0, 0.12) 17%, rgba(0, 0, 0, 0) 23%),
            linear-gradient(to left,
                #000 0%, rgba(0, 0, 0, 0.9) 3%, rgba(0, 0, 0, 0.62) 7%,
                rgba(0, 0, 0, 0.32) 12%, rgba(0, 0, 0, 0.12) 17%, rgba(0, 0, 0, 0) 23%);
    }

    /*
     * The global clamp bottoms out well short of the width available in
     * portrait, so the title gets its own scale here — it's the poster, it
     * should fill the frame.
     */
    html[lang="en"] .hero__title {
        font-size: clamp(3rem, 14vw, 5.2rem);
    }

    html[lang="he"] .hero__title {
        font-size: clamp(3.2rem, 15.5vw, 5.6rem);
    }

    .hero__img {
        object-position: center 30%;
    }

    /* Resolve to solid black by the foot of the band so there is no seam. */
    .hero__scrim {
        background:
            linear-gradient(to bottom,
                rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.12) 12%, rgba(0, 0, 0, 0) 26%),
            linear-gradient(to bottom,
                rgba(0, 0, 0, 0) 44%, rgba(0, 0, 0, 0.14) 55%, rgba(0, 0, 0, 0.36) 65%,
                rgba(0, 0, 0, 0.6) 73%, rgba(0, 0, 0, 0.8) 80%, rgba(0, 0, 0, 0.93) 86%,
                rgba(0, 0, 0, 0.99) 92%, #000 96%);
    }

    .hero__content {
        padding-bottom: clamp(3rem, 8vh, 5rem);
    }

    .footer__inner {
        flex-direction: column;
        gap: 0.9rem;
        text-align: center;
    }
}

@media (max-width: 560px) {
    .specs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .spec:nth-child(3n + 1) {
        border-inline-start: 1px solid var(--line);
    }

    .spec:nth-child(2n + 1) {
        border-inline-start: 0;
    }

    .spec:nth-last-child(-n + 3) {
        border-bottom: 1px solid var(--line);
    }

    .spec:nth-last-child(-n + 2) {
        border-bottom: 0;
    }

    /* Every pixel of width is a pixel of legible script — break the gutter. */
    .reader {
        max-width: none;
        margin-inline: calc(var(--gutter) * -1);
    }
}

/* Short landscape phones: the pinned hero would swallow the whole viewport. */
@media (max-height: 520px) and (orientation: landscape) {
    .hero {
        height: 128vh;
    }

    .hero__cue {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   13. Motion & print
   -------------------------------------------------------------------------- */

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

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }

    .js .hero__content > * {
        opacity: 1;
        transform: none;
    }

    .hero__cue {
        display: none;
    }
}

@media print {
    .hero,
    .footer,
    #excerpt {
        display: none;
    }

    .sheet {
        box-shadow: none;
        border-top: 0;
    }
}
