/*
 * Copyright (c) 2026 Tecirli Project. All Rights Reserved
 * Filename: site.css
 * Author: Michael Taciroglu
 * Date Created: September 28, 2026
 * Description: All styles for the site. Colours and type are tokens at the top.
 */

/* Palette is sampled from the artwork: the map's ocean teal and parchment land, the
   copper of its route pins, and the leaf green of the logo. */
:root {
    --teal-900: #0d3439;
    --teal-800: #0f3a40;
    --teal-700: #1b5a61;
    --teal-500: #2c8791;
    --parchment: #f4ecdc;
    --parchment-deep: #eadcc0;
    --paper: #fbf7ef;
    --sand: #cdb892;
    --copper: #a9491f;
    --copper-bright: #d0692f;
    --leaf: #7cb83a;
    --ink: #2b2520;
    --ink-soft: #5b5047;
    --on-dark: #f7efdf;

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

    --measure: 40rem;
    --wide: 74rem;
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --radius: 1.25rem;
    --shadow: 0 1.5rem 3rem -1.5rem rgb(43 37 32 / 35%);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    background:
        radial-gradient(120% 60% at 100% 0%, rgb(205 184 146 / 22%), transparent 60%),
        var(--parchment);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.7;
    overflow-x: hidden;
}

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

a {
    color: var(--teal-700);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--copper);
}

:focus-visible {
    outline: 3px solid var(--copper-bright);
    outline-offset: 3px;
    border-radius: 4px;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.12;
    letter-spacing: -0.01em;
    color: var(--teal-800);
    text-wrap: balance;
}

h2 {
    font-size: clamp(1.9rem, 3.6vw, 2.75rem);
    margin: 0 0 1.25rem;
}

h3 {
    font-size: 1.4rem;
    margin: 0 0 0.75rem;
}

/* Fraunces grows hairline-thin at its large optical sizes: automatic sizing turned the
   crossbar of a 90px "e" into a line that vanished, so "Tecirli" read as "Tccirli".
   Every use of the display face is capped at a sturdier optical size instead. */
h1,
h2,
h3,
.brand-name,
.lead,
.kicker,
.stats strong,
.watermark,
.contact-intro,
.notfound strong,
.chapter-about .prose > p:first-of-type::first-letter,
.chapter-intro .prose > p:first-of-type::first-letter {
    font-optical-sizing: none;
    font-variation-settings: "opsz" 36;
}

p {
    margin: 0 0 1.15em;
    text-wrap: pretty;
}

.skip {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--teal-800);
    color: var(--on-dark);
    border-radius: 0.5rem;
}

.skip:focus {
    top: 1rem;
}

/* ---------- masthead ---------- */

.masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgb(244 236 220 / 86%);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    border-bottom: 1px solid rgb(205 184 146 / 45%);
}

.masthead-inner {
    max-width: var(--wide);
    margin: 0 auto;
    padding: 0.6rem var(--gutter);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--teal-800);
    margin-right: auto;
}

.brand img {
    width: auto;
    height: 2.4rem;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.nav ul {
    gap: 1.6rem;
}

.nav a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"] {
    color: var(--teal-700);
    border-bottom-color: var(--copper-bright);
}

.langs ul {
    gap: 0.15rem;
    padding: 0.2rem;
    border-radius: 999px;
    background: rgb(205 184 146 / 28%);
}

.langs a {
    display: block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
}

.langs a:hover {
    color: var(--teal-800);
    background: rgb(251 247 239 / 70%);
}

.langs a[aria-current="true"] {
    background: var(--teal-800);
    color: var(--on-dark);
}

/* The menu toggle is a real checkbox so it works without JavaScript; it is moved off
   screen rather than hidden so it stays focusable and the label shows its focus ring. */
.menu-toggle {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.menu-button {
    display: none;
}

@media (max-width: 62rem) {
    .masthead-inner {
        flex-wrap: wrap;
        gap: 0;
    }

    .menu-button {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        cursor: pointer;
        font-weight: 600;
        font-size: 0.95rem;
        padding: 0.45rem 0.8rem;
        border-radius: 999px;
        border: 1px solid var(--sand);
        color: var(--teal-800);
    }

    .menu-icon,
    .menu-icon::before,
    .menu-icon::after {
        display: block;
        width: 1.1rem;
        height: 2px;
        background: currentColor;
        border-radius: 2px;
        transition: transform 0.2s ease;
    }

    .menu-icon {
        position: relative;
    }

    .menu-icon::before,
    .menu-icon::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .menu-icon::before {
        top: -6px;
    }

    .menu-icon::after {
        top: 6px;
    }

    .menu-toggle:focus-visible + .menu-button {
        outline: 3px solid var(--copper-bright);
        outline-offset: 3px;
    }

    .menu {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem 0 0.75rem;
    }

    .menu-toggle:checked ~ .menu {
        display: flex;
    }

    .menu-toggle:checked + .menu-button .menu-icon {
        background: transparent;
    }

    .menu-toggle:checked + .menu-button .menu-icon::before {
        transform: translateY(6px) rotate(45deg);
    }

    .menu-toggle:checked + .menu-button .menu-icon::after {
        transform: translateY(-6px) rotate(-45deg);
    }

    .nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .nav a {
        display: block;
        padding: 0.7rem 0;
        border-bottom: 1px solid rgb(205 184 146 / 45%);
        font-size: 1.1rem;
    }

    .nav a[aria-current="page"] {
        border-bottom-color: rgb(205 184 146 / 45%);
        color: var(--copper);
    }

    .langs ul {
        flex-wrap: wrap;
        justify-content: flex-start;
        border-radius: 1rem;
    }

    .langs a {
        font-size: 0.9rem;
        padding: 0.35rem 0.75rem;
    }
}

/* ---------- hero ---------- */

/* Each hero image is masked to transparent at its lower edge so it dissolves into the
   parchment body instead of ending on a hard line. */
.hero {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-end;
    min-height: clamp(30rem, 82vh, 48rem);
    padding: 7rem var(--gutter) clamp(7rem, 16vh, 10rem);
    color: var(--on-dark);
}

.hero-photo {
    min-height: clamp(24rem, 62vh, 36rem);
}

.hero-short {
    min-height: clamp(26rem, 70vh, 38rem);
    align-items: center;
}

.hero-art {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
}

.hero-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-art::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(100deg, rgb(13 52 57 / 88%) 0%, rgb(13 52 57 / 55%) 45%, rgb(13 52 57 / 5%) 80%),
        linear-gradient(to top, rgb(13 52 57 / 60%), transparent 45%);
}

.hero-map .hero-art img {
    object-position: 58% 40%;
    animation: drift 40s ease-in-out infinite alternate;
}

.hero-library .hero-art img {
    object-position: 50% 35%;
}

.hero-shoebox .hero-art img {
    object-position: 50% 55%;
}

@keyframes drift {
    from {
        transform: scale(1.04) translate3d(0, 0, 0);
    }

    to {
        transform: scale(1.1) translate3d(-2%, -1%, 0);
    }
}

.hero-inner {
    width: 100%;
    max-width: var(--wide);
    margin: 0 auto;
}

.hero h1 {
    color: var(--on-dark);
    font-size: clamp(2.8rem, 8vw, 6rem);
    font-weight: 450;
    line-height: 1;
    margin: 0 0 1.25rem;
    max-width: 14ch;
}

.kicker {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #e9b98f;
    margin: 0 0 1rem;
}

.lead {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.2vw, 1.55rem);
    font-weight: 300;
    line-height: 1.45;
    max-width: 34rem;
    margin: 0 0 2.5rem;
}

.stats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem clamp(1.5rem, 5vw, 3.5rem);
}

.stats li {
    display: flex;
    flex-direction: column;
    padding-left: 1rem;
    border-left: 2px solid var(--copper-bright);
}

.stats strong {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 500;
    line-height: 1.1;
}

.stats span {
    font-size: 0.95rem;
    opacity: 0.85;
}

/* ---------- chapters ---------- */

.chapter {
    position: relative;
    padding: clamp(3rem, 8vw, 6rem) var(--gutter);
}

.chapter-inner {
    position: relative;
    max-width: var(--wide);
    margin: 0 auto;
}

.prose {
    max-width: var(--measure);
}

.chapter .prose {
    margin-left: clamp(0rem, 8vw, 7rem);
}

.chapter-about .prose > p:first-of-type::first-letter,
.chapter-intro .prose > p:first-of-type::first-letter {
    float: left;
    font-family: var(--font-display);
    font-size: 4.2em;
    line-height: 0.85;
    padding: 0.08em 0.1em 0 0;
    color: var(--copper);
}

.with-art {
    display: grid;
    gap: 2rem;
}

.art-tree {
    order: -1;
    justify-self: center;
    width: min(22rem, 80vw);
    margin-top: -6rem;
    filter: drop-shadow(0 1.5rem 2rem rgb(43 37 32 / 25%));
}

@media (min-width: 60rem) {
    .with-art {
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
        align-items: start;
    }

    .with-art .prose {
        margin-left: clamp(0rem, 4vw, 4rem);
    }

    .art-tree {
        order: 0;
        position: sticky;
        top: 6rem;
        width: 100%;
        max-width: 30rem;
        margin-top: -9rem;
    }
}

.watermark {
    position: absolute;
    right: 0;
    top: -1rem;
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(6rem, 22vw, 17rem);
    font-weight: 300;
    line-height: 1;
    color: var(--sand);
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
}

.chapter-surnames .prose,
.chapter-why .prose {
    position: relative;
}

/* ---------- full-bleed bands ---------- */

/* A band lays an image across the full width and feathers it into the page at the top
   and bottom, with the text on a translucent paper panel above it. */
.band {
    position: relative;
    isolation: isolate;
    padding: clamp(8rem, 20vw, 14rem) var(--gutter);
}

.band-art {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
}

.band-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.band-inner {
    max-width: var(--wide);
    margin: 0 auto;
    display: flex;
}

.band-family-tree .band-inner {
    justify-content: flex-end;
}

.band-family-tree .band-art img {
    object-position: 30% 50%;
}

.band-lab .band-art img {
    object-position: 20% 40%;
}

.panel {
    background: rgb(251 247 239 / 90%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: clamp(1.5rem, 4vw, 3rem);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- home closing ---------- */

.closing {
    position: relative;
    isolation: isolate;
    display: grid;
    align-items: center;
    min-height: 34rem;
    padding: clamp(4rem, 10vw, 8rem) var(--gutter);
}

.closing-art {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(100%, 62rem);
    z-index: -1;
    -webkit-mask-image:
        linear-gradient(to right, transparent 0%, #000 45%),
        linear-gradient(to bottom, transparent 0%, #000 28%, #000 78%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(to right, transparent 0%, #000 45%),
        linear-gradient(to bottom, transparent 0%, #000 28%, #000 78%, transparent 100%);
    mask-composite: intersect;
}

.closing-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.closing-inner {
    width: 100%;
    max-width: var(--wide);
    margin: 0 auto;
}

.closing-inner > * {
    max-width: 28rem;
}

.closing h2 {
    font-size: clamp(2rem, 4.2vw, 3.2rem);
}

@media (max-width: 48rem) {
    .closing {
        align-items: end;
        min-height: 40rem;
    }

    .closing-art {
        width: 100%;
        height: 60%;
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 60%, transparent 100%);
        mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 60%, transparent 100%);
    }
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    border: 0;
    border-radius: 999px;
    background: var(--teal-800);
    color: var(--on-dark);
    font: 600 1rem/1.2 var(--font-body);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 0.75rem 1.5rem -0.75rem rgb(13 52 57 / 60%);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.button::after {
    content: "→";
}

.button:hover {
    background: var(--copper);
    color: var(--on-dark);
    transform: translateY(-1px);
}

.button[disabled] {
    opacity: 0.6;
    cursor: progress;
    transform: none;
}

/* ---------- research ---------- */

.map-figure {
    max-width: 64rem;
    margin: clamp(1rem, 4vw, 3rem) auto clamp(2rem, 6vw, 4rem);
    padding: 0 var(--gutter);
}

/* The map is informational and carries the Esri credit in its lower-right corner, so it
   is only feathered at the sides and keeps its full height. */
.map-figure img {
    width: 100%;
    border-radius: var(--radius);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 4%, #000 96%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, #000 4%, #000 96%, transparent 100%);
}

.map-figure figcaption {
    max-width: var(--measure);
    margin: 1rem auto 0;
    text-align: center;
    font-style: italic;
    color: var(--ink-soft);
    font-size: 1rem;
}

.wide {
    max-width: var(--wide);
}

.section-lead {
    color: var(--ink-soft);
    max-width: var(--measure);
    margin-bottom: 2.5rem;
}

.groups {
    columns: 2 22rem;
    column-gap: clamp(2rem, 5vw, 4rem);
}

.group {
    break-inside: avoid;
    padding: 1.25rem 0 1.5rem;
    border-top: 1px solid rgb(205 184 146 / 70%);
}

.group h3 {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.group h3::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    flex: none;
    border-radius: 50%;
    background: var(--copper-bright);
    box-shadow: 0 0 0 4px rgb(208 105 47 / 20%);
    transform: translateY(-0.15em);
}

.chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chips li {
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    background: rgb(251 247 239 / 80%);
    border: 1px solid rgb(205 184 146 / 70%);
    font-size: 0.95rem;
    color: var(--ink);
}

.haplo-heading {
    margin-top: 3rem;
}

.chips-haplo li {
    background: var(--teal-800);
    border-color: var(--teal-800);
    color: var(--on-dark);
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.3rem 1rem;
}

/* ---------- document submission ---------- */

.submit-layout {
    display: grid;
    gap: clamp(2rem, 5vw, 4rem);
}

@media (min-width: 62rem) {
    .submit-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
        align-items: start;
    }

    .chapter-submit .prose {
        margin-left: 0;
    }

    .submit-form {
        position: sticky;
        top: 5.5rem;
        margin-top: -10rem;
    }
}

.contact-intro {
    font-family: var(--font-display);
    font-size: 1.3rem;
    line-height: 1.5;
    color: var(--teal-800);
}

.doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-list li {
    position: relative;
    padding: 0.55rem 0 0.55rem 1.6rem;
    border-bottom: 1px solid rgb(205 184 146 / 45%);
}

.doc-list li::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: 1.15rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--copper-bright);
}

.submit-form {
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px solid rgb(205 184 146 / 45%);
}

.submit-form h2 {
    font-size: 1.8rem;
}

.field {
    margin-bottom: 1.1rem;
}

.field label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

.field input,
.field textarea {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--sand);
    border-radius: 0.6rem;
    padding: 0.65rem 0.8rem;
}

.field input[type="file"] {
    padding: 0.55rem;
    background: rgb(234 220 192 / 35%);
    border-style: dashed;
}

.field input[type="file"]::file-selector-button {
    font: 600 0.9rem var(--font-body);
    margin-right: 0.8rem;
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: 999px;
    background: var(--teal-800);
    color: var(--on-dark);
    cursor: pointer;
}

.field input:focus,
.field textarea:focus {
    outline: 3px solid rgb(44 135 145 / 35%);
    border-color: var(--teal-500);
}

.hint,
.privacy {
    font-size: 0.9rem;
    color: var(--ink-soft);
    margin: 0.4rem 0 0;
}

.privacy {
    margin: 1rem 0 1.25rem;
}

.trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.cf-turnstile {
    min-height: 65px;
}

.form-status {
    margin: 1rem 0 0;
    font-weight: 600;
}

.form-status:empty {
    display: none;
}

.form-status.is-ok {
    color: #2f6b1c;
}

.form-status.is-error {
    color: #9b2c1a;
}

/* ---------- 404 ---------- */

.notfound {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
    font-size: 1.15rem;
}

.notfound strong {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.notfound a {
    color: #f2c9a3;
}

/* ---------- footer ---------- */

.colophon {
    padding: 2.5rem var(--gutter) 3rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.colophon p {
    margin: 0;
}

/* ---------- motion ---------- */

/* Scroll-linked reveal is progressive enhancement: browsers without view timelines, and
   anyone who prefers reduced motion, see the content in place with no animation. */
@media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
        .reveal {
            animation: rise linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 35%;
        }
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(2.5rem);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-map .hero-art img {
        animation: none;
    }

    .button {
        transition: none;
    }
}
