/* =========================================================================
   Theme tokens — the app sites' theme (Cairn backup, Video Alignment Tool,
   DOTE Whisper) with the hue rotated to clay (same saturation and
   lightness, 1.4rem radius).
   ========================================================================= */
:root {
    --background: rgb(253, 253, 253);
    --foreground: rgb(0, 0, 0);
    --card: rgb(253, 253, 253);
    --card-foreground: rgb(0, 0, 0);
    --primary: rgb(159, 123, 102);
    --primary-foreground: rgb(250, 250, 249);
    --secondary: rgb(217, 211, 208);
    --secondary-foreground: rgb(8, 8, 8);
    --muted: rgb(245, 245, 245);
    --muted-foreground: rgb(115, 115, 115);
    --accent: rgb(89, 73, 64);
    --accent-foreground: rgb(255, 255, 255);
    --border: rgb(231, 231, 238);
    --ring: rgb(190, 174, 165);
    --sidebar: rgb(250, 248, 246);

    /* Pricing tier badge colours */
    --tier-free: rgb(102, 159, 108);
    --tier-licensed: rgb(102, 102, 159);

    --font-sans: "Plus Jakarta Sans", system-ui, sans-serif;
    --font-serif: "Lora", Georgia, serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --radius: 1.4rem;

    --shadow-sm:
        0px 2px 3px 0px hsl(0 0% 0% / 0.16),
        0px 1px 2px -1px hsl(0 0% 0% / 0.16);
    --shadow-md:
        0px 2px 3px 0px hsl(0 0% 0% / 0.16),
        0px 2px 4px -1px hsl(0 0% 0% / 0.16);
    --shadow-lg:
        0px 2px 3px 0px hsl(0 0% 0% / 0.16),
        0px 4px 6px -1px hsl(0 0% 0% / 0.16);
    --shadow-xl:
        0px 2px 3px 0px hsl(0 0% 0% / 0.16),
        0px 8px 10px -1px hsl(0 0% 0% / 0.16);

    --tracking: -0.025em;
}

.dark {
    --background: rgb(7, 5, 3);
    --foreground: rgb(249, 248, 247);
    --card: rgb(16, 13, 8);
    --card-foreground: rgb(249, 248, 247);
    --primary: rgb(190, 174, 165);
    --primary-foreground: rgb(4, 3, 2);
    --secondary: rgb(38, 33, 26);
    --secondary-foreground: rgb(231, 228, 223);
    --muted: rgb(30, 26, 20);
    --muted-foreground: rgb(146, 143, 138);
    --accent: rgb(89, 73, 64);
    --accent-foreground: rgb(255, 255, 255);
    --border: rgb(47, 40, 27);
    --ring: rgb(190, 174, 165);
    --sidebar: rgb(4, 3, 2);

    --tier-free: rgb(175, 190, 165);
    --tier-licensed: rgb(165, 165, 190);

    --shadow-sm:
        0px 2px 12px 0px hsl(0 0% 0% / 0.35),
        0px 1px 2px -1px hsl(0 0% 0% / 0.35);
    --shadow-md:
        0px 2px 12px 0px hsl(0 0% 0% / 0.35),
        0px 2px 4px -1px hsl(0 0% 0% / 0.35);
    --shadow-lg:
        0px 2px 12px 0px hsl(0 0% 0% / 0.35),
        0px 4px 6px -1px hsl(0 0% 0% / 0.35);
    --shadow-xl:
        0px 2px 12px 0px hsl(0 0% 0% / 0.35),
        0px 8px 10px -1px hsl(0 0% 0% / 0.35);
}

/* =========================================================================
   Base / reset
   ========================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    border: 0 solid var(--border);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5.5rem; /* clears the sticky header for anchor jumps */
}

body {
    margin: 0;
    font-family: var(--font-sans);
    letter-spacing: var(--tracking);
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
}

p {
    margin: 0 0 1rem;
}

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

/* Links inside running text */
.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--primary) 55%, transparent);
    text-underline-offset: 0.18em;
}
.dark .prose a {
    color: var(--primary);
}
.prose a:hover {
    text-decoration-color: currentColor;
}

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

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 3px;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

.muted {
    color: var(--muted-foreground);
}
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin: 0 0 0.75rem;
}
.dark .eyebrow {
    color: var(--primary);
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.8rem 1.4rem;
    border-radius: calc(var(--radius) * 0.62);
    cursor: pointer;
    transition:
        transform 0.08s ease,
        box-shadow 0.15s ease,
        background 0.15s ease,
        opacity 0.15s ease;
    white-space: nowrap;
}
.btn:active {
    transform: translateY(1px);
}
.btn svg {
    width: 1.1em;
    height: 1.1em;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    box-shadow: var(--shadow-md);
    opacity: 0.94;
}

.btn-outline {
    background: transparent;
    color: var(--foreground);
    box-shadow: inset 0 0 0 1px var(--border);
}
.btn-outline:hover {
    background: var(--muted);
}

.btn-icon {
    padding: 0.55rem;
    border-radius: 999px;
    background: transparent;
    color: var(--foreground);
    box-shadow: inset 0 0 0 1px var(--border);
    cursor: pointer;
}
.btn-icon:hover {
    background: var(--muted);
}

/* =========================================================================
   Cards / badges
   ========================================================================= */
.card {
    background: var(--card);
    color: var(--card-foreground);
    border-radius: var(--radius);
    box-shadow:
        inset 0 0 0 1px var(--border),
        var(--shadow-sm);
    padding: 1.6rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--secondary-foreground);
}

/* =========================================================================
   Header / nav
   ========================================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--background) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.site-header .container {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 4.25rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.25rem;
    white-space: nowrap;
}
.brand .logo-mark {
    width: 2rem;
    height: 2rem;
    color: var(--foreground);
    flex: none;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}
.nav-links a.navlink {
    padding: 0.5rem 0.85rem;
    border-radius: 0.7rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--muted-foreground);
}
.nav-links a.navlink:hover {
    color: var(--foreground);
    background: var(--muted);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.4rem;
}

.nav-toggle {
    display: none;
}

/* Support (Buy Me a Coffee) — a quiet outline button with a clay heart */
.btn-support {
    padding: 0.55rem 1.1rem;
}
.btn-support svg {
    color: var(--accent);
}
.dark .btn-support svg {
    color: var(--primary);
}

@media (max-width: 760px) {
    .nav-links {
        position: fixed;
        inset: 4.25rem 0 auto 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        background: var(--background);
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1.5rem 1.25rem;
        box-shadow: var(--shadow-lg);
        transform: translateY(-120%);
        transition: transform 0.2s ease;
        margin-left: 0;
    }
    body.nav-open .nav-links {
        transform: translateY(0);
    }
    .nav-links a.navlink {
        padding: 0.75rem 0.85rem;
    }
    .header-actions {
        margin-left: auto;
    }
    .nav-toggle {
        display: inline-flex;
    }
}

/* =========================================================================
   Intro — portrait beside a short, first-person bio
   ========================================================================= */
.intro {
    position: relative;
    overflow: hidden;
    padding: clamp(1.5rem, 9vw, 3.5rem) 0 clamp(1rem, 7vw, 3rem);
}
.intro::before {
    content: "";
    position: absolute;
    inset: -40% 0 auto 0;
    height: 70%;
    background: radial-gradient(
        55% 60% at 30% 0%,
        color-mix(in srgb, var(--primary) 22%, transparent),
        transparent 70%
    );
    pointer-events: none;
    z-index: -1;
}
.intro-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(1.75rem, 5vw, 3.5rem);
    align-items: center;
}
.portrait {
    width: clamp(9rem, 22vw, 13rem);
    aspect-ratio: 1;
    border-radius: 999px;
    object-fit: cover;
    box-shadow:
        0 0 0 6px var(--background),
        0 0 0 7px var(--border),
        var(--shadow-lg);
}
.intro h1 {
    font-size: clamp(2.3rem, 5.5vw, 3.6rem);
    margin-bottom: 0.35em;
}
.intro .lede {
    font-size: clamp(1.05rem, 2vw, 1.22rem);
    color: var(--muted-foreground);
    max-width: 52ch;
}
.intro .lede strong {
    color: var(--foreground);
    font-weight: 600;
}
.intro-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: var(--muted-foreground);
}
.intro-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.intro-meta svg {
    width: 1rem;
    height: 1rem;
    color: var(--primary);
}
@media (max-width: 640px) {
    .intro-grid {
        grid-template-columns: 1fr;
        justify-items: start;
    }
}

/* =========================================================================
   Sections
   ========================================================================= */
section {
    padding: clamp(3rem, 7vw, 5rem) 0;
}
.section-head {
    max-width: 60ch;
    margin: 0 0 2.25rem;
}
.section-head h2 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
}
.section-head p {
    color: var(--muted-foreground);
    font-size: 1.05rem;
    margin: 0;
}

.band {
    background: var(--sidebar);
    border-block: 1px solid var(--border);
}

/* =========================================================================
   App cards — the whole card is one link to the App site (new tab).
   Two columns; a part-filled last row is centred.
   ========================================================================= */
.app-grid {
    --gap: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap);
}
.app-card {
    flex: 0 1 calc((100% - var(--gap)) / 2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.15s ease;
}
@media (max-width: 760px) {
    .app-card {
        flex-basis: 100%;
    }
}
a.app-card[href]:hover {
    transform: translateY(-3px);
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, var(--border)),
        var(--shadow-xl);
}
.app-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.app-icon {
    width: 4rem;
    height: 4rem;
    flex: none;
    border-radius: 0.9rem;
    box-shadow: var(--shadow-sm);
    transition: filter 0.15s ease;
}
.app-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
}
.app-title h3 {
    font-size: 1.4rem;
    margin: 0;
}
.app-body {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
}
.app-body p {
    color: var(--muted-foreground);
    font-size: 0.95rem;
    margin: 0;
}
.app-credit {
    font-size: 0.8rem !important;
}
.app-go,
.app-soon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.app-go {
    color: var(--foreground);
}
.app-go svg {
    width: 0.95rem;
    height: 0.95rem;
    transition: transform 0.15s ease;
}
a.app-card[href]:hover .app-go svg {
    transform: translate(2px, -2px);
}

/* Coming soon: the App site couldn't be reached at page load. The card stays
   readable but greyed out, and no longer links (site.js drops its href). */
.app-soon {
    display: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}
.app-card[data-status="soon"] {
    opacity: 0.72;
}
.app-card[data-status="soon"] .app-icon {
    filter: grayscale(1);
    opacity: 0.6;
}
.app-card[data-status="soon"] .app-go {
    display: none;
}
.app-card[data-status="soon"] .app-soon {
    display: inline-flex;
}

/* Pricing tier badges */
.badge[data-tier] {
    flex: none;
}
.badge[data-tier="free"] {
    background: color-mix(in srgb, var(--tier-free) 24%, transparent);
    color: rgb(52, 92, 57);
}
.badge[data-tier="freemium"] {
    background: color-mix(in srgb, #b8860b 20%, transparent);
    color: #7a5800;
}
.badge[data-tier="licensed"] {
    background: color-mix(in srgb, var(--tier-licensed) 24%, transparent);
    color: rgb(62, 62, 112);
}
.dark .badge[data-tier="free"] {
    color: var(--tier-free);
}
.dark .badge[data-tier="freemium"] {
    color: #e8c060;
}
.dark .badge[data-tier="licensed"] {
    color: var(--tier-licensed);
}

/* =========================================================================
   Principles — "Why I build these"
   ========================================================================= */
.principles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 1.25rem;
}
.principle .icon-wrap {
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: calc(var(--radius) * 0.55);
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    color: var(--accent);
    margin-bottom: 1rem;
}
.dark .principle .icon-wrap {
    color: var(--primary);
}
.principle .icon-wrap svg {
    width: 1.5rem;
    height: 1.5rem;
}
.principle h3 {
    font-family: var(--font-sans);
    font-size: 1.12rem;
    margin-bottom: 0.4rem;
}
.principle p {
    color: var(--muted-foreground);
    margin: 0;
    font-size: 0.95rem;
}

/* =========================================================================
   Contact
   ========================================================================= */
.contact {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem 3rem;
    align-items: center;
}
.contact h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}
.contact p {
    color: var(--muted-foreground);
    margin: 0;
    max-width: 52ch;
}
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
@media (max-width: 760px) {
    .contact {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--sidebar);
    padding: 2.5rem 0;
    font-size: 0.9rem;
    color: var(--muted-foreground);
}
.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    flex-wrap: wrap;
}
.site-footer a:hover {
    color: var(--foreground);
}
.site-footer .foot-links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    /* Heart only; the label stays for screen readers */
    .btn-support {
        padding: 0.55rem;
        border-radius: 999px;
    }
    .btn-support svg {
        width: 18px;
        height: 18px;
    }
    .support-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    .brand {
        font-size: 1.1rem;
        gap: 0.45rem;
    }
    .brand .logo-mark {
        width: 1.7rem;
        height: 1.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        transition: none !important;
    }
}

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

[hidden] {
    display: none !important;
}
