/* ==========================================================================
   Yakitori platform theme
   Fiery embers over warm ash grays, matching the macOS app's palette.
   Palette mirrors Sources/WritingTrackerApp/UI/Theme.swift.
   ========================================================================== */

:root {
    --ember: #ed5426;
    --ember-deep: #a32112;
    --gold: #fab340;
    --cream: #fcf5e8;

    --ash-950: #141110;
    --ash-900: #1a1717;
    --ash-850: #201c1a;
    --ash-800: #262120;
    --ash-750: #2e2927;
    --ash-700: #3a332f;
    --ash-600: #4c443f;
    --ash-500: #6b625c;
    --ash-400: #948a83;
    --ash-300: #bcb2aa;
    --ash-200: #dcd4cc;
    --ash-100: #f0eae3;

    --bg: var(--ash-950);
    --panel: var(--ash-850);
    --panel-raised: var(--ash-800);
    --border: rgba(220, 212, 204, 0.10);
    --border-strong: rgba(220, 212, 204, 0.18);
    --text: var(--ash-100);
    --muted: var(--ash-400);
    --danger: #d96459;
    --success: #7bb98a;

    --gradient-brand: linear-gradient(135deg, var(--ember) 0%, var(--gold) 100%);
    --gradient-panel: linear-gradient(160deg, rgba(237, 84, 38, 0.10), rgba(250, 179, 64, 0.02));

    --radius: 12px;
    --radius-lg: 18px;
    --wrap: 1040px;
    --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.85);

    /* Frosted "liquid glass" surfaces over the warm ash/ember base. */
    --glass-bg: rgba(38, 33, 31, 0.52);
    --glass-bg-strong: rgba(40, 35, 32, 0.66);
    --glass-bg-soft: rgba(46, 41, 39, 0.38);
    --glass-border: rgba(240, 234, 227, 0.13);
    --glass-border-strong: rgba(250, 179, 64, 0.22);
    --glass-highlight: rgba(255, 255, 255, 0.09);
    --glass-blur: saturate(150%) blur(20px);
    --glass-shadow: 0 24px 60px -34px rgba(0, 0, 0, 0.92);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Avenir Next", "SF Pro Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 520px at 78% -8%, rgba(237, 84, 38, 0.22), transparent 62%),
        radial-gradient(760px 480px at 8% 8%, rgba(250, 179, 64, 0.13), transparent 60%),
        radial-gradient(900px 700px at 50% 120%, rgba(163, 33, 18, 0.18), transparent 65%);
    z-index: 0;
}

/* Slow-drifting ember orbs. They give the frosted surfaces something to blur;
   animation is disabled for motion-sensitive users. */
body::after {
    content: "";
    position: fixed;
    inset: -20%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(360px 360px at 20% 30%, rgba(237, 84, 38, 0.20), transparent 70%),
        radial-gradient(300px 300px at 80% 65%, rgba(250, 179, 64, 0.14), transparent 70%),
        radial-gradient(420px 420px at 55% 90%, rgba(163, 33, 18, 0.18), transparent 72%);
    filter: blur(10px);
    animation: ember-drift 44s ease-in-out infinite alternate;
}

@keyframes ember-drift {
    from { transform: translate3d(-3%, -2%, 0) scale(1); }
    to { transform: translate3d(4%, 3%, 0) scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
    body::after { animation: none; }
}

a { color: var(--gold); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--cream); text-decoration: none; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 0 0 18px; font-weight: 700; }
h2 { font-size: 1.35rem; margin: 0 0 12px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.content { position: relative; z-index: 1; min-height: 60vh; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(20, 17, 16, 0.55);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 68px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    box-shadow: 0 4px 14px -4px rgba(237, 84, 38, 0.7);
}
.brand .brand-name {
    font-weight: 700;
    font-size: 1.18rem;
    letter-spacing: 0.01em;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.site-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
/* Exclude buttons: `.site-nav a` would otherwise beat `.button` and leave the
   "Create account" button with muted text on the bright brand gradient. */
.site-nav a:not(.button) { color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.site-nav a:not(.button):hover { color: var(--cream); }

/* Hamburger toggle: hidden on desktop, shown on mobile. */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 10px;
    border: 1px solid var(--glass-border-strong);
    border-radius: 10px;
    background: var(--glass-bg-soft);
    cursor: pointer;
}
.nav-toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.site-header.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--gradient-brand);
    color: #2a1406;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    box-shadow: 0 10px 26px -12px rgba(237, 84, 38, 0.9);
    transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.button:hover { filter: brightness(1.06); transform: translateY(-1px); color: #2a1406; }
.button:active { transform: translateY(0); }

.button-small { padding: 8px 15px; font-size: 0.88rem; }

.button-ghost {
    background: var(--glass-bg-soft);
    color: var(--text);
    border-color: var(--glass-border-strong);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}
.button-ghost:hover { background: var(--glass-bg); color: var(--cream); filter: none; }

.button-danger { background: linear-gradient(135deg, #c94436, #8f2318); color: #fff; }
.button-danger:hover { color: #fff; }

.link-button {
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.link-button:hover { color: var(--cream); text-decoration: underline; }
.inline-form { display: inline; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { padding: 84px 22px 56px; }
.hero-inner {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 48px;
    align-items: center;
}
.hero h1 { margin-bottom: 20px; }
.hero .lede { font-size: 1.2rem; color: var(--ash-300); max-width: 560px; margin: 0 0 28px; }
.hero-icon {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    border-radius: 26%;
    box-shadow: 0 40px 80px -40px rgba(237, 84, 38, 0.85), 0 0 0 1px rgba(250, 179, 64, 0.15);
}
.eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 18px;
}

.lede { font-size: 1.12rem; color: var(--ash-300); }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------------
   Sections and cards
   -------------------------------------------------------------------------- */

.section { padding: 56px 22px; }
.section-title { font-size: 1.7rem; margin-bottom: 8px; }
.section-sub { color: var(--muted); margin: 0 0 34px; max-width: 640px; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.card, .feature {
    background: var(--glass-bg);
    background-image: var(--gradient-panel);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}
.card + .card { margin-top: 16px; }
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(237, 84, 38, 0.14);
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 14px;
}
.feature h2 { font-size: 1.1rem; margin-bottom: 8px; }
.feature p { color: var(--muted); margin: 0; font-size: 0.95rem; }

.note {
    background: var(--glass-bg-soft);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--ember);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}

/* --------------------------------------------------------------------------
   Pricing
   -------------------------------------------------------------------------- */

.price-card {
    position: relative;
    background: var(--glass-bg-strong);
    background-image: var(--gradient-panel);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 34px;
    max-width: 460px;
    margin: 34px 0;
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}

/* Trial and lifetime side by side when there is room, stacked otherwise. */
.tiers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
    margin: 34px 0;
}
.tiers > .card,
.tiers > .price-card {
    max-width: none;
    margin: 0;
    height: 100%;
}
.tiers > .card { display: flex; flex-direction: column; }
.tiers > .card .button { align-self: flex-start; margin-top: auto; }

@media (max-width: 760px) {
    .tiers { grid-template-columns: 1fr; }
}
.price-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: var(--gradient-brand);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    pointer-events: none;
}
.price { font-size: 3rem; font-weight: 800; letter-spacing: -0.03em; }
.price .currency { font-size: 1.6rem; vertical-align: super; }
.price-note { color: var(--muted); margin: 4px 0 20px; }
.check-list { list-style: none; padding: 0; margin: 0 0 24px; }
.check-list li { padding: 7px 0 7px 28px; position: relative; color: var(--ash-200); }
.check-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--gold);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Pages, prose, footer
   -------------------------------------------------------------------------- */

.page { padding: 56px 22px; }
.prose { max-width: 720px; }
.prose h2 { margin-top: 34px; color: var(--cream); }
.prose p { color: var(--ash-300); }
.fine-print { color: var(--muted); font-size: 0.9rem; }

.site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--glass-border);
    margin-top: 72px;
    color: var(--muted);
    background: rgba(20, 17, 16, 0.5);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}
.footer-inner { display: flex; justify-content: space-between; gap: 16px; padding: 28px 22px; flex-wrap: wrap; align-items: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; }
.footer-brand img { width: 24px; height: 24px; border-radius: 6px; }
.site-footer nav { display: flex; gap: 18px; }

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.messages { margin-top: 22px; }
.message {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    margin-bottom: 10px;
}
.message.success { border-color: rgba(123, 185, 138, 0.5); }
.message.error { border-color: rgba(217, 100, 89, 0.55); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); }
th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tbody tr:hover { background: rgba(237, 84, 38, 0.04); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

label { display: block; margin: 16px 0 7px; font-size: 0.92rem; color: var(--ash-200); }
input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea, select {
    width: 100%;
    padding: 11px 13px;
    background: var(--glass-bg-soft);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--ember);
    box-shadow: 0 0 0 3px rgba(237, 84, 38, 0.18);
}
textarea { min-height: 120px; resize: vertical; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; margin: 18px 0; }
.checkbox input { width: auto; margin-top: 4px; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    border: 1px solid var(--border-strong);
    color: var(--muted);
}
.badge-active { border-color: rgba(123, 185, 138, 0.6); color: var(--success); }
.badge-revoked, .badge-disabled, .badge-suspended, .badge-deleted, .badge-pending_deletion {
    border-color: rgba(217, 100, 89, 0.6);
    color: var(--danger);
}

/* --------------------------------------------------------------------------
   Account area
   -------------------------------------------------------------------------- */

.account-layout {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 34px;
    padding: 44px 22px;
    align-items: start;
}
.account-nav { display: flex; flex-direction: column; gap: 3px; }
.account-nav a {
    color: var(--muted);
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.account-nav a:hover { background: var(--ash-850); color: var(--cream); }
.account-nav a.active {
    background: var(--glass-bg);
    color: var(--cream);
    border-color: var(--glass-border);
    box-shadow: inset 2px 0 0 var(--ember), inset 0 1px 0 var(--glass-highlight);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}
.account-main { min-width: 0; }

/* --------------------------------------------------------------------------
   Profiles and social
   -------------------------------------------------------------------------- */

.profile-header { display: flex; align-items: center; gap: 18px; }
.profile-header h1 { margin: 0; }
.handle { color: var(--muted); margin: 2px 0 0; }
.avatar { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-strong); }
.avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-brand);
    color: #2a1406;
    font-size: 1.9rem;
    font-weight: 800;
}
.avatar-small { width: 38px; height: 38px; font-size: 1rem; }
.profile-stats { display: flex; gap: 20px; color: var(--muted); }
.member-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.member-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius);
}
.member-list a:hover { background: var(--ash-850); }
.member-list .handle { display: block; color: var(--muted); font-size: 0.88rem; }

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

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.htmx-indicator { opacity: 0; transition: opacity 0.12s ease-in; }
.htmx-request .htmx-indicator { opacity: 1; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 820px) {
    .hero { padding-top: 56px; }
    .hero-inner { grid-template-columns: 1fr; gap: 32px; text-align: center; }
    .hero .lede { margin-left: auto; margin-right: auto; }
    .cta-row { justify-content: center; }
    .hero-icon { max-width: 220px; }
    .account-layout { grid-template-columns: 1fr; gap: 20px; }
    .account-nav { flex-direction: row; flex-wrap: wrap; }
    .account-nav a.active { box-shadow: inset 0 -2px 0 var(--ember); }

    /* Give the nav more room before it has to stack. */
    .header-inner { gap: 12px; }
    .site-nav { gap: 14px; }
}

/* Mobile: show the hamburger and collapse the nav into a dropdown. */
@media (max-width: 760px) {
    .header-inner {
        flex-wrap: wrap;
        row-gap: 10px;
        min-height: 0;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .brand img { width: 28px; height: 28px; border-radius: 8px; }
    .brand .brand-name { font-size: 1.05rem; }

    .nav-toggle { display: inline-flex; }

    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding-top: 8px;
        border-top: 1px solid var(--glass-border);
    }
    .site-header.nav-open .site-nav { display: flex; }
    .site-nav a:not(.button) {
        font-size: 0.95rem;
        padding: 9px 2px;
        border-radius: 8px;
    }
    .site-nav a:not(.button):hover { color: var(--cream); }
    .site-nav .button { align-self: flex-start; margin-top: 6px; }
    .button-small { padding: 8px 14px; font-size: 0.88rem; }
}
