/* ==========================================================================
   CODETICA — Reset, base typography, layout primitives
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
    margin: 0;
    background: var(--ink-1000);
    color: var(--on-dark);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: var(--lh-normal);
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body.is-locked {
    overflow: hidden;
}

img,
svg,
video,
picture {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    line-height: var(--lh-snug);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}

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

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    padding: 0;
    display: block;
}

hr {
    border: 0;
    border-top: 1px solid var(--line-dark);
    margin: 0;
}

::selection {
    background: var(--accent);
    color: var(--ink-1000);
}

:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 3px;
    border-radius: var(--r-xs);
}

.section--light :focus-visible {
    outline-color: var(--brand);
}

/* ------------------------------------------------------------- Utilities */

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

.container--narrow {
    max-width: var(--container-narrow);
}

.container--wide {
    max-width: 1620px;
}

@media (min-width: 1800px) {
    .container--wide { max-width: 1720px; }
}

@media (min-width: 2130px) {
    .container--wide { max-width: clamp(1720px, 81vw, 2300px); }
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: var(--s-3);
    left: var(--s-3);
    z-index: 999;
    padding: var(--s-3) var(--s-5);
    background: var(--accent);
    color: var(--ink-1000);
    font-weight: 600;
    border-radius: var(--r-sm);
    transform: translateY(-160%);
    transition: transform var(--dur-2) var(--ease-out);
}

.skip-link:focus {
    transform: translateY(0);
}

/* --------------------------------------------------------- Section shells */

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

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

.section--dark {
    background: var(--ink-1000);
    color: var(--on-dark);
}

.section--deep {
    background: var(--ink-900);
    color: var(--on-dark);
}

.section--light {
    background: var(--paper);
    color: var(--on-light);
}

.section--alt {
    background: var(--paper-alt);
    color: var(--on-light);
}

.section--light + .section--light,
.section--alt + .section--alt {
    border-top: 1px solid var(--line-light);
}

/* ------------------------------------------------------------- Typography */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    margin: 0;
    font-family: var(--font-mono);
    font-size: var(--fs-eyebrow);
    font-weight: 500;
    letter-spacing: var(--tracking-eyebrow);
    text-transform: uppercase;
    color: var(--accent);
}

.eyebrow::before {
    content: '';
    width: 22px;
    height: 1px;
    background: currentColor;
    opacity: .7;
    flex: none;
}

.eyebrow--plain::before {
    display: none;
}

.section--light .eyebrow,
.section--alt .eyebrow {
    color: var(--brand);
}

.display {
    font-size: var(--fs-display);
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-display);
    font-weight: 600;
}

.h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: var(--tracking-display); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); }
.h4 { font-size: var(--fs-h4); }

.lead {
    font-size: var(--fs-lead);
    line-height: var(--lh-relaxed);
    color: var(--on-dark-2);
    max-width: 58ch;
}

.section--light .lead,
.section--alt .lead {
    color: var(--on-light-2);
}

.text-accent {
    color: var(--accent);
}

.section--light .text-accent,
.section--alt .text-accent {
    color: var(--brand);
}

.muted {
    color: var(--on-dark-3);
}

.section--light .muted,
.section--alt .muted {
    color: var(--on-light-3);
}

.mono {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: .04em;
}

/* --------------------------------------------------------- Section header */

.section-head {
    display: grid;
    gap: var(--s-5);
    max-width: 62ch;
    margin-bottom: clamp(2.5rem, 1.5rem + 2.6vw, 4.5rem);
}

.section-head__title {
    font-size: var(--fs-h2);
    line-height: 1.08;
    letter-spacing: var(--tracking-display);
}

.section-head--split {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s-8);
    max-width: none;
}

.section-head--split > div:first-child {
    display: grid;
    gap: var(--s-5);
    max-width: 62ch;
}

/* ------------------------------------------------------------ Placeholder */

.ph {
    position: relative;
    color: inherit;
    opacity: .82;
}

body.demo .ph {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
    cursor: help;
}

.ph-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
    border-radius: var(--r-pill);
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
    white-space: nowrap;
}

.section--light .ph-badge,
.section--alt .ph-badge {
    color: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 40%, transparent);
}

body:not(.demo) .ph-badge,
body:not(.demo) .demo-only {
    display: none !important;
}

/* ------------------------------------------------------------ Reveal-in */

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
}

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

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

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

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