/* ============================================================
   Aetheryl Labs — design system
   Light is the default; dark is applied via html[data-theme=dark].
   ============================================================ */

:root {
    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

    --bg: #f7f7f4;
    --surface: #ffffff;
    --surface-2: #efefe9;
    --text: #1c1f23;
    --muted: #5d646e;
    --border: #e2e2db;
    --accent: #3355cc;
    --accent-strong: #2742a8;
    --accent-soft: rgba(51, 85, 204, 0.08);
    --accent-soft-border: rgba(51, 85, 204, 0.22);
    --ok: #0c8a5a;
    --ok-soft: rgba(12, 138, 90, 0.10);
    --warn: #b45309;
    --warn-soft: rgba(180, 83, 9, 0.12);
    --danger: #b3222c;
    --danger-soft: rgba(179, 34, 44, 0.10);
    --shadow: 0 1px 2px rgba(20, 24, 30, 0.05), 0 8px 24px rgba(20, 24, 30, 0.06);
    --radius: 12px;
    --radius-sm: 8px;
    --maxw: 1080px;
}

html[data-theme="dark"] {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1e242d;
    --text: #e7e9ec;
    --muted: #99a0a8;
    --border: #2a313b;
    --accent: #7b8cff;
    --accent-strong: #93a0ff;
    --accent-soft: rgba(123, 140, 255, 0.14);
    --accent-soft-border: rgba(123, 140, 255, 0.30);
    --ok: #3dd68c;
    --ok-soft: rgba(61, 214, 140, 0.12);
    --warn: #f0b429;
    --warn-soft: rgba(240, 180, 41, 0.14);
    --danger: #f06a6f;
    --danger-soft: rgba(240, 106, 111, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1.1em; }

.lead { font-size: 1.13rem; color: var(--muted); }

.mono { font-family: var(--font-mono); font-size: 0.85em; }

/* ---------- header / nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 62px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand svg { width: 30px; height: 30px; display: block; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.nav-links a {
    display: inline-block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.95rem;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--accent); }
.nav-links a.btn { color: #fff; }

.nav-actions { display: flex; align-items: center; gap: 10px; }

@media (max-width: 840px) {
    .nav { flex-wrap: wrap; padding: 10px 0; }
    .nav-links { order: 3; width: 100%; justify-content: space-between; }
}

/* ---------- theme toggle ---------- */
.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .icon-sun { display: inline; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

/* ---------- buttons ---------- */
.btn {
    display: inline-block;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
    transition: transform 0.08s ease, background 0.15s, border-color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent-soft-border); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }

/* ---------- hero ---------- */
.hero {
    padding: clamp(48px, 8vw, 96px) 0 40px;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 40px;
    align-items: center;
}
.hero-copy h1 { margin-bottom: 0.35em; }
.hero-copy .subhead { font-size: clamp(1.05rem, 2vw, 1.25rem); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-note { margin-top: 14px; color: var(--muted); font-size: 0.9rem; }

.hero-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
}
.hero-card h3 { margin-top: 0; }
.hero-card ul { margin: 0; padding-left: 18px; }
.hero-card li { margin: 6px 0; color: var(--muted); }

@media (max-width: 840px) {
    .hero { grid-template-columns: 1fr; }
}

/* ---------- cards / grids ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 840px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card .tags { margin-bottom: 14px; }

.tag {
    display: inline-block;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    margin: 0 6px 8px 0;
}
.tag-btn { display: inline-block; margin: 0 6px 8px 0; text-decoration: none; }
.tag-btn:hover { color: var(--accent); text-decoration: none; }

/* ---------- sections ---------- */
.section { padding: clamp(36px, 6vw, 64px) 0; }
.section-alt { background: var(--surface-2); }
.section-title { text-align: center; max-width: 620px; margin: 0 auto 40px; }
.section-title p { color: var(--muted); }

.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ---------- feature list (services) ---------- */
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .icon {
    flex: 0 0 42px;
    width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 10px;
    font-size: 20px;
}
.feature h3 { margin: 0 0 4px; }

/* ---------- article lists ---------- */
.article-list { display: grid; gap: 16px; }
.article-item {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.article-item:hover { text-decoration: none; border-color: var(--accent-soft-border); box-shadow: var(--shadow); }
.article-item h3 { color: var(--text); margin: 6px 0 4px; }
.article-item .meta { font-size: 0.85rem; color: var(--muted); }
.article-item p { color: var(--muted); margin: 8px 0 0; }

.meta { font-size: 0.85rem; color: var(--muted); }
.meta time { white-space: nowrap; }

/* ---------- article body ---------- */
.article {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(20px, 4vw, 44px);
    box-shadow: var(--shadow);
    max-width: 760px;
}
.article h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.article .byline { margin: 12px 0 26px; color: var(--muted); }
.article-body p { margin: 0 0 1.15em; }
.article-body ul, .article-body ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.article-body li { margin: 0.3em 0; }
.article-body a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- pricing ---------- */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
@media (max-width: 840px) { .price-grid { grid-template-columns: 1fr; } }
.price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}
.price-card.featured { border: 2px solid var(--accent); }
.price-card .price { font-size: 2rem; font-weight: 700; margin: 8px 0 2px; }
.price-card .per { color: var(--muted); font-size: 0.9rem; }
.price-card ul { flex: 1; padding-left: 18px; color: var(--muted); margin-top: 14px; }
.price-card li { margin: 6px 0; }
.price-card .btn { margin-top: 18px; }

.callout {
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 16px 20px;
    color: var(--text);
}
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-weight: 600; font-size: 0.92rem; }
.form-row .hint { color: var(--muted); font-size: 0.85rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 160px; resize: vertical; }
select[multiple] { min-height: 120px; }

.hp-field {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* ---------- flash messages ---------- */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin: 0 0 18px;
    font-weight: 500;
}
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- badge / stat ---------- */
.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 9px;
    border-radius: 999px;
}
.badge-new { background: var(--accent-soft); color: var(--accent); }
.badge-read { background: var(--surface-2); color: var(--muted); }
.badge-replied { background: var(--ok-soft); color: var(--ok); }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted);
    font-weight: 500;
}
.pagination a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 56px; }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 28px;
    padding: 40px 0 24px;
}
.footer-grid h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 8px 0; }
.footer-grid a, .footer-grid li { color: var(--muted); }
.footer-grid a:hover { color: var(--accent); }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.85rem;
}
@media (max-width: 840px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- tables (admin) ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.table th, table.table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.table th { background: var(--surface-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
table.table tr:last-child td { border-bottom: 0; }

/* ---------- admin shell ---------- */
.admin-body { background: var(--bg); }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
    width: 230px;
    flex: 0 0 230px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-side .side-brand { font-weight: 700; font-size: 1rem; display: block; margin-bottom: 18px; color: var(--text); }
.admin-side a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: 0.93rem; }
.admin-side a:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
.admin-side a.active { background: var(--accent-soft); color: var(--accent); }
.admin-side .side-sub { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 16px 6px 6px; }
.admin-main { flex: 1; padding: 28px 32px; min-width: 0; }
.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.admin-top h1 { margin: 0; font-size: 1.5rem; }
.admin-top .who { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 840px) {
    .admin-shell { flex-direction: column; }
    .admin-side { width: 100%; flex: auto; height: auto; position: static; }
    .admin-main { padding: 20px 16px; }
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 840px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat .num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: 0.85rem; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a, .tabs button {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
}
.tabs a:hover { color: var(--accent); }
.tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.text-danger { color: var(--danger); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stacked-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 14px;
    z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

.error-page { text-align: center; padding: 90px 20px 60px; }
.error-page h1 { font-size: 3rem; }
.error-page .code { font-family: var(--font-mono); font-size: 0.95rem; color: var(--muted); }