/* ==========================================================================
   SKYFIELD — Marketing OS design system
   Pixel-art daylight: a sky you research under, a meadow where hypotheses grow.
   Tokens mirror the Skyfield design system (tokens.json). Legacy names
   (--primary, --text-main…) alias the new ones so older templates follow.
   ========================================================================== */

:root {
    /* Scene — the sky and meadow the pixel canvas paints */
    --sky-700: #1766C9;
    --sky-500: #2F8FEA;
    --sky-300: #7FC0F5;
    --cloud: #FFFFFF;
    --cloud-shade: #D6EAFA;
    --meadow-700: #24553A;
    --meadow-500: #3F8F43;
    --meadow-300: #8CC152;
    --bark: #6B4A2F;
    --sun: #F5C33B;
    --poppy: #D8453B;

    /* App surfaces — cloud-white with a blue bias */
    --surface-page: #F3F8FD;
    --surface-raised: #FFFFFF;
    --surface-sunk: #E6F0FA;
    --line: #CFE0F0;
    --line-mid: #A9C4DE;
    --line-strong: #6F8DAC;

    /* Ink */
    --ink: #0D2640;
    --ink-muted: #45617E;
    --ink-faint: #526C87;
    --on-sky: #FFFFFF;
    --on-action: #FFFFFF;

    /* Action & status */
    --action: #1766C9;
    --action-hover: #1257AE;
    --action-soft: #E2EEFC;
    --action-line: #B5D3F5;
    --success-ink: #2B7536;
    --success-soft: #E3F3E1;
    --success-line: #B9DDB5;
    --warning-ink: #865600;
    --warning-soft: #FDF3D3;
    --warning-line: #F2D98A;
    --danger-ink: #B3302A;
    --danger-soft: #FBE6E4;
    --danger-line: #F1C0BB;

    /* Glass — controls floating on the sky and over foliage */
    --glass-sky: rgba(255, 255, 255, 0.16);
    --glass-sky-hover: rgba(255, 255, 255, 0.26);
    --glass-sky-line: rgba(255, 255, 255, 0.34);
    --glass-leaf: rgba(20, 60, 44, 0.74);
    --glass-leaf-line: rgba(140, 193, 82, 0.28);

    /* Type */
    --font-wordmark: 'Instrument Serif', 'Times New Roman', Georgia, serif;
    --font-display: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-sans: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-pixel: 'Pixelify Sans', 'Onest', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;

    /* Space (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;

    /* Radii — soft, the way pixel clouds round off */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* Elevation — tinted with ink, never grey */
    --shadow-xs: 0 1px 2px rgba(13, 38, 64, 0.06);
    --shadow-sm: 0 1px 2px rgba(13, 38, 64, 0.06), 0 2px 6px rgba(13, 38, 64, 0.06);
    --shadow-md: 0 4px 10px rgba(13, 38, 64, 0.08), 0 1px 3px rgba(13, 38, 64, 0.06);
    --shadow-lg: 0 12px 28px -6px rgba(13, 38, 64, 0.18), 0 4px 10px rgba(13, 38, 64, 0.06);
    --shadow-xl: 0 24px 48px -12px rgba(13, 38, 64, 0.28);
    --focus-ring: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--action);

    /* Legacy aliases used across templates */
    --bg-body: var(--surface-page);
    --surface: var(--surface-raised);
    --surface-subtle: var(--surface-sunk);
    --surface-card: var(--surface-raised);
    --text-main: var(--ink);
    --text-muted: var(--ink-muted);
    --text-faint: var(--ink-faint);
    --text-inverse: #FFFFFF;
    --border-light: var(--line);
    --border-medium: var(--line-mid);
    --border-focus: var(--action);
    --primary: var(--action);
    --primary-hover: var(--action-hover);
    --primary-light: var(--action-soft);
    --primary-border: var(--action-line);
    --success: var(--success-ink);
    --success-light: var(--success-soft);
    --success-border: var(--success-line);
    --success-text: #1F5A29;
    --warning: #C98A00;
    --warning-light: var(--warning-soft);
    --warning-border: var(--warning-line);
    --warning-text: var(--warning-ink);
    --danger: var(--danger-ink);
    --danger-light: var(--danger-soft);
    --danger-border: var(--danger-line);
    --danger-text: #8E2520;
    --info: var(--action);
    --info-light: var(--action-soft);
    --info-border: var(--action-line);
}

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--surface-page);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Header: wordmark + glass controls on the sky ----------------------- */
.sf-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 64px;
    padding: 0 max(var(--space-4), 3vw);
    background: var(--sky-700);
    color: var(--on-sky);
}
.sf-page-hero .sf-header {
    position: absolute;
    left: 0;
    right: 0;
    background: transparent;
}
.sf-wordmark {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    color: var(--on-sky);
    text-decoration: none;
    font-family: var(--font-wordmark);
    font-size: 28px;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.sf-wordmark .sf-version {
    font-family: var(--font-pixel);
    font-size: 11px;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--glass-sky);
    border: 1px solid var(--glass-sky-line);
}
.sf-glass-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: var(--radius-md);
    background: var(--glass-sky);
    border: 1px solid var(--glass-sky-line);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.sf-glass-nav > * + * { margin-left: 2px; }
.sf-glass-item,
.sf-glass-nav select {
    font: 500 13.5px/1 var(--font-sans);
    color: var(--on-sky);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.15s ease;
}
.sf-glass-nav select { max-width: 230px; }
.sf-glass-nav select option { color: var(--ink); background: var(--surface-raised); }
.sf-glass-item:hover,
.sf-glass-nav select:hover { background: var(--glass-sky-hover); }
.sf-glass-item.active { background: var(--cloud); color: var(--ink); }
.sf-glass-divider { width: 1px; align-self: stretch; margin: 6px 2px; background: var(--glass-sky-line); }
/* The language switch marks its choice quietly, so the white "cloud" item always means "the tool you are in" */
.sf-glass-item.sf-lang.active { background: var(--glass-sky-hover); color: var(--on-sky); font-weight: 700; }

/* ---- Tool choice: the two doors on the home page ------------------------ */
.sf-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); max-width: 920px; }
.sf-choice {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-6);
    background: var(--surface-raised);
    color: var(--ink);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sf-choice:hover { transform: translateY(-2px); }
.sf-choice-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.sf-choice-icon {
    width: 40px; height: 40px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--action-soft); color: var(--action);
}
.sf-choice-icon.meadow { background: var(--success-soft); color: var(--success-ink); }
.sf-choice h2 { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -0.015em; }
.sf-choice p { margin: 0; font-size: 14.5px; color: var(--ink-muted); }
.sf-choice ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; color: var(--ink); }
.sf-choice li { display: flex; gap: 8px; align-items: baseline; }
.sf-choice li::before { content: ""; width: 6px; height: 6px; flex: none; background: var(--meadow-500); transform: translateY(-2px); }
.sf-choice .sf-btn,
.sf-choice .sf-btn-quiet { align-self: flex-start; margin-top: auto; }

/* ---- Buttons ------------------------------------------------------------ */
.btn-saas-primary,
.sf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: 600 14px/1.2 var(--font-sans);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.btn-saas-primary,
.sf-btn-primary { background: var(--action); color: var(--on-action); box-shadow: var(--shadow-xs); }
.btn-saas-primary:hover,
.sf-btn-primary:hover { background: var(--action-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-saas-primary:active,
.sf-btn:active { transform: translateY(0); }
.btn-saas-primary:disabled,
.sf-btn:disabled { opacity: 0.8; cursor: progress; transform: none; }

/* Cloud: the white button that sits on the sky */
.sf-btn-cloud { background: var(--cloud); color: var(--ink); box-shadow: 0 2px 0 rgba(13, 38, 64, 0.18); }
.sf-btn-cloud:hover { background: var(--cloud-shade); }
/* Glass: the quiet button on the sky */
.sf-btn-glass { background: var(--glass-sky); color: var(--on-sky); border-color: var(--glass-sky-line); }
.sf-btn-glass:hover { background: var(--glass-sky-hover); }

.btn-saas-secondary,
.sf-btn-quiet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font: 600 13.5px/1.2 var(--font-sans);
    padding: 9px 14px;
    background: var(--surface-raised);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-saas-secondary:hover,
.sf-btn-quiet:hover { background: var(--surface-sunk); border-color: var(--line-mid); color: var(--ink); }

.btn-icon-setting {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 0;
    background: transparent;
    color: var(--on-sky);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.btn-icon-setting:hover { background: var(--glass-sky-hover); }

/* ---- Status chips: pixel labels ---------------------------------------- */
.saas-chip,
.sf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    font: 500 12px/1.4 var(--font-pixel);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.saas-chip-indigo,  .sf-chip-sky     { background: var(--action-soft);  color: var(--action);      border: 1px solid var(--action-line); }
.saas-chip-emerald, .sf-chip-meadow  { background: var(--success-soft); color: var(--success-ink); border: 1px solid var(--success-line); }
.saas-chip-amber,   .sf-chip-sun     { background: var(--warning-soft); color: var(--warning-ink); border: 1px solid var(--warning-line); }
.saas-chip-rose,    .sf-chip-poppy   { background: var(--danger-soft);  color: var(--danger-ink);  border: 1px solid var(--danger-line); }
.saas-chip-slate,   .sf-chip-neutral { background: var(--surface-sunk); color: var(--ink-muted);   border: 1px solid var(--line); }

/* Eyebrow — pixel caption above a heading */
.sf-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 500 13px/1.3 var(--font-pixel);
    letter-spacing: 0.03em;
    color: var(--ink-muted);
}

/* ---- Task chip: glass leaf floating over the scene ---------------------- */
.sf-task-stack { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; justify-items: start; }
.sf-task {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--glass-leaf);
    border: 1px solid var(--glass-leaf-line);
    color: #FFFFFF;
    font: 600 14px/1.2 var(--font-sans);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 18px -6px rgba(8, 24, 16, 0.5);
}
.sf-task-state { font: 400 12px/1.2 var(--font-pixel); color: #CFE6B8; letter-spacing: 0.02em; }
.sf-task-dot { width: 6px; height: 6px; background: var(--meadow-300); flex: none; }
.sf-task.running .sf-task-dot { background: var(--sun); animation: sf-blink 1.2s steps(2, end) infinite; }
@keyframes sf-blink { 50% { opacity: 0.25; } }

/* ---- Cards -------------------------------------------------------------- */
.saas-card,
.sf-card {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.saas-card:hover { border-color: var(--line-mid); }

/* ---- Fields ------------------------------------------------------------- */
.sf-field {
    width: 100%;
    font: 400 15px/1.3 var(--font-sans);
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sf-field::placeholder { color: var(--ink-faint); }
.sf-field:focus { border-color: var(--action); box-shadow: 0 0 0 3px var(--action-soft); }

/* ---- Hero --------------------------------------------------------------- */
.sf-hero {
    position: relative;
    overflow: hidden;
    color: var(--on-sky);
    background: var(--sky-700);
    padding: 112px max(var(--space-4), 3vw) 96px;
}
.sf-scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.sf-hero-inner {
    position: relative;
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: var(--space-8);
    align-items: start;
}
.sf-hero-copy { max-width: 640px; }
.sf-hero .sf-eyebrow { color: var(--on-sky); }
/* A soft ink halo keeps white copy legible where it crosses a cloud or the tree */
.sf-hero-title, .sf-hero-sub, .sf-hero .sf-eyebrow { text-shadow: 0 1px 0 rgba(13, 38, 64, 0.35), 0 0 14px rgba(13, 38, 64, 0.35); }
.sf-hero-title {
    margin: var(--space-4) 0 var(--space-4);
    font: 400 clamp(34px, 4.6vw, 58px)/1.08 var(--font-display);
    letter-spacing: -0.025em;
    color: var(--on-sky);
    text-wrap: balance;
}
.sf-hero-sub {
    margin: 0 0 var(--space-6);
    max-width: 56ch;
    font: 500 16.5px/1.55 var(--font-sans);
    color: var(--on-sky);
}
.sf-hero-form {
    background: var(--surface-raised);
    color: var(--ink);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    box-shadow: var(--shadow-xl);
    max-width: 620px;
}
.sf-hero-tasks { padding-top: 210px; justify-self: end; }

/* ---- Grass edge above the footer --------------------------------------- */
.sf-grass-edge {
    height: 12px;
    background:
        linear-gradient(90deg, transparent 0 8px, var(--meadow-500) 8px 12px, transparent 12px 20px, var(--meadow-500) 20px 24px, transparent 24px 36px, var(--meadow-500) 36px 40px, transparent 40px) 0 0 / 48px 4px repeat-x,
        linear-gradient(var(--meadow-500), var(--meadow-500)) 0 4px / 100% 8px no-repeat;
    image-rendering: pixelated;
}
.sf-footer {
    background: var(--meadow-700);
    color: #DCEBD2;
    padding: var(--space-4) max(var(--space-4), 3vw);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
}
.sf-footer .sf-wordmark { font-size: 20px; color: #FFFFFF; }

/* ---- Modal -------------------------------------------------------------- */
.saas-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(13, 38, 64, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.saas-modal-backdrop.active { display: flex; }
.saas-modal-box {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 28px;
    box-shadow: var(--shadow-xl);
    animation: modalPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalPop {
    0% { opacity: 0; transform: scale(0.96) translateY(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- Markdown dossier --------------------------------------------------- */
.prose-dossier { color: var(--ink); line-height: 1.7; font-size: 15px; }
.prose-dossier h1 { font: 600 24px/1.25 var(--font-display); letter-spacing: -0.015em; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin: 28px 0 16px; }
.prose-dossier h2 { font: 600 19px/1.3 var(--font-display); margin: 24px 0 12px; }
.prose-dossier h3 { font: 600 15.5px/1.35 var(--font-display); margin: 18px 0 8px; color: var(--action); }
.prose-dossier p { margin: 0 0 14px; color: var(--ink-muted); }
.prose-dossier ul, .prose-dossier ol { margin: 0 0 16px; padding-left: 24px; color: var(--ink-muted); }
.prose-dossier li { margin-bottom: 6px; }
.prose-dossier table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.prose-dossier th, .prose-dossier td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.prose-dossier th { background: var(--surface-sunk); font-weight: 600; color: var(--ink); }
.prose-dossier blockquote { margin: 16px 0; padding: 12px 18px; background: var(--action-soft); color: var(--ink); border-radius: var(--radius-sm); font-style: italic; }
.prose-dossier code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-sunk); border: 1px solid var(--line); padding: 2px 6px; border-radius: 4px; color: var(--action); }
.prose-dossier strong { font-weight: 700; color: var(--ink); }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
    .sf-hero-inner { grid-template-columns: 1fr; }
    .sf-hero-tasks { display: none; }
}
@media (max-width: 640px) {
    .sf-header { flex-wrap: wrap; padding-block: var(--space-2); }
    .sf-glass-nav select { max-width: 150px; }
    .sf-choice-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .sf-hide-narrow,
    .sf-glass-nav .sf-hide-narrow { display: none; }
    .sf-glass-nav { max-width: 100%; }
    .sf-glass-item { padding: 9px 10px; }
    .sf-hero { padding-top: 132px; }
    .sf-hero-sub { font-size: 15.5px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
