/* ==========================================================================
   Seeable.Life design system
   --------------------------------------------------------------------------
   Canonical source: branding/seeable.css
   Mirrored to (keep in sync — each app is served from its own static root):
     - landing/seeable.css
     - fortune_stick_site/static/css/seeable.css
     - bazi-calculator/frontend/src/seeable.css

   The `--fc-` / `.fc-` prefix is retained as an internal namespace; renaming
   it would touch every rule and template for no user-visible gain.

   Design intent: a calm, modern reading product. Neutral warm-grey surfaces,
   ink-black as the primary action colour, and exactly one accent (teal) used
   for emphasis, focus and data. No ornament, no gradients, no drop shadows
   heavier than a hairline.
   ========================================================================== */

:root {
    /* ---- Surfaces ------------------------------------------------------ */
    --fc-bg: #faf9f8;
    --fc-surface: #ffffff;
    --fc-surface-2: #f5f4f2;
    --fc-surface-3: #ecebe8;

    /* ---- Ink ----------------------------------------------------------- */
    --fc-ink: #1a1917;
    --fc-ink-2: #56534d;
    --fc-ink-3: #8a857d;
    --fc-ink-4: #b5b0a8;
    --fc-on-ink: #faf9f8;

    /* ---- Lines --------------------------------------------------------- */
    --fc-line: #e4e2de;
    --fc-line-strong: #d2cfc9;

    /* ---- Accent (one, and only one) ------------------------------------ */
    --fc-accent: #0f766e;
    --fc-accent-hover: #0c5f59;
    --fc-accent-soft: #e6f2f0;
    --fc-accent-line: #b9dbd6;

    /* ---- Data / status ------------------------------------------------- */
    --fc-pos: #2f7d4f;
    --fc-warn: #a86a12;
    --fc-neg: #b03f36;
    --fc-info: #3a5f9e;
    --fc-pos-soft: #eaf3ed;
    --fc-warn-soft: #fbf2e3;
    --fc-neg-soft: #f8ecea;

    /* ---- Type ---------------------------------------------------------- */
    --fc-font-sans:
        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Noto Sans TC", "Noto Sans SC", "PingFang TC", "Microsoft JhengHei",
        sans-serif;
    --fc-font-serif:
        "Noto Serif TC", "Noto Serif SC", "Songti TC", Georgia, serif;
    --fc-font-mono:
        ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --fc-text-xs: 0.75rem;
    --fc-text-sm: 0.8125rem;
    --fc-text-base: 0.9375rem;
    --fc-text-md: 1rem;
    --fc-text-lg: 1.125rem;
    --fc-text-xl: 1.375rem;
    --fc-text-2xl: 1.75rem;
    --fc-text-3xl: 2.25rem;
    --fc-text-4xl: 3rem;

    /* ---- Space (4pt grid) ---------------------------------------------- */
    --fc-1: 4px;
    --fc-2: 8px;
    --fc-3: 12px;
    --fc-4: 16px;
    --fc-5: 20px;
    --fc-6: 24px;
    --fc-8: 32px;
    --fc-10: 40px;
    --fc-12: 48px;
    --fc-16: 64px;
    --fc-20: 80px;
    --fc-24: 96px;

    /* ---- Radius -------------------------------------------------------- */
    --fc-r-sm: 6px;
    --fc-r: 10px;
    --fc-r-lg: 14px;
    --fc-r-full: 999px;

    /* ---- Elevation (hairlines, not shadows) ---------------------------- */
    --fc-shadow-sm: 0 1px 2px rgba(26, 25, 23, 0.04);
    --fc-shadow: 0 1px 3px rgba(26, 25, 23, 0.06), 0 1px 2px rgba(26, 25, 23, 0.04);
    --fc-shadow-lg: 0 4px 16px rgba(26, 25, 23, 0.08);
    --fc-shadow-pop: 0 12px 32px rgba(26, 25, 23, 0.12);

    /* ---- Motion -------------------------------------------------------- */
    --fc-ease: cubic-bezier(0.2, 0, 0.13, 1);
    --fc-fast: 120ms var(--fc-ease);
    --fc-mid: 220ms var(--fc-ease);
    --fc-slow: 420ms var(--fc-ease);

    /* ---- Layout -------------------------------------------------------- */
    --fc-max: 1120px;
    --fc-max-prose: 68ch;
    --fc-header-h: 52px;
    --fc-gutter: 24px;
}

@media (max-width: 640px) {
    :root {
        --fc-gutter: 16px;
        --fc-text-3xl: 1.875rem;
        --fc-text-4xl: 2.25rem;
    }
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--fc-bg);
    color: var(--fc-ink);
    font-family: var(--fc-font-sans);
    font-size: var(--fc-text-base);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
    margin: 0;
}

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

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

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

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

:focus-visible {
    outline: 2px solid var(--fc-accent);
    outline-offset: 2px;
    border-radius: var(--fc-r-sm);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Typography primitives
   ========================================================================== */

.fc-display {
    font-family: var(--fc-font-serif);
    font-size: var(--fc-text-4xl);
    line-height: 1.14;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.fc-h1 {
    font-family: var(--fc-font-serif);
    font-size: var(--fc-text-3xl);
    line-height: 1.2;
    letter-spacing: -0.015em;
    font-weight: 600;
}

.fc-h2 {
    font-family: var(--fc-font-serif);
    font-size: var(--fc-text-2xl);
    line-height: 1.25;
    letter-spacing: -0.01em;
    font-weight: 600;
}

.fc-h3 {
    font-size: var(--fc-text-lg);
    line-height: 1.35;
    font-weight: 600;
}

.fc-lead {
    font-size: var(--fc-text-md);
    line-height: 1.55;
    color: var(--fc-ink-2);
    max-width: var(--fc-max-prose);
}

.fc-body {
    color: var(--fc-ink-2);
    max-width: var(--fc-max-prose);
}

.fc-muted {
    color: var(--fc-ink-3);
}

.fc-eyebrow {
    font-size: var(--fc-text-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fc-ink-3);
}

.fc-num {
    font-feature-settings: "tnum" 1;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

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

.fc-section {
    padding-block: var(--fc-10);
}

.fc-section--tight {
    padding-block: var(--fc-6);
}

.fc-stack > * + * {
    margin-top: var(--fc-3);
}

.fc-stack-lg > * + * {
    margin-top: var(--fc-6);
}

.fc-row {
    display: flex;
    align-items: center;
    gap: var(--fc-3);
}

.fc-divider {
    height: 1px;
    background: var(--fc-line);
    border: 0;
    margin-block: var(--fc-5);
}

.fc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fc-hidden {
    display: none !important;
}

/* ==========================================================================
   App shell — header / nav / footer
   ========================================================================== */

.fc-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 249, 248, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--fc-line);
}

.fc-header__inner {
    display: flex;
    align-items: center;
    gap: var(--fc-5);
    min-height: var(--fc-header-h);
    width: 100%;
    max-width: var(--fc-max);
    margin-inline: auto;
    padding-inline: var(--fc-gutter);
}

.fc-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--fc-2);
    flex: 0 0 auto;
    color: var(--fc-ink);
}

.fc-brand__mark {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    color: var(--fc-accent);
}

.fc-brand__name {
    font-size: var(--fc-text-md);
    font-weight: 650;
    letter-spacing: -0.015em;
}

.fc-nav {
    display: flex;
    align-items: center;
    gap: var(--fc-1);
    margin-inline-start: auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.fc-nav::-webkit-scrollbar {
    display: none;
}

.fc-nav a {
    padding: 6px 10px;
    border-radius: var(--fc-r-sm);
    font-size: var(--fc-text-sm);
    font-weight: 500;
    color: var(--fc-ink-2);
    white-space: nowrap;
    transition: color var(--fc-fast), background var(--fc-fast);
}

.fc-nav a:hover {
    color: var(--fc-ink);
    background: var(--fc-surface-2);
}

.fc-nav a.active,
.fc-nav a[aria-current="page"] {
    color: var(--fc-ink);
    background: var(--fc-surface-3);
}

.fc-footer {
    border-top: 1px solid var(--fc-line);
    margin-top: var(--fc-10);
    padding-block: var(--fc-5);
}

.fc-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--fc-4);
    width: 100%;
    max-width: var(--fc-max);
    margin-inline: auto;
    padding-inline: var(--fc-gutter);
    font-size: var(--fc-text-sm);
    color: var(--fc-ink-3);
}

.fc-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fc-5);
}

.fc-footer__links a:hover {
    color: var(--fc-ink);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.fc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fc-2);
    min-height: 40px;
    padding: 0 var(--fc-4);
    border: 1px solid transparent;
    border-radius: var(--fc-r-sm);
    background: none;
    font-size: var(--fc-text-base);
    font-weight: 550;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--fc-fast), border-color var(--fc-fast),
        color var(--fc-fast), transform var(--fc-fast), opacity var(--fc-fast);
}

.fc-btn:active {
    transform: translateY(0.5px);
}

.fc-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.fc-btn--primary {
    background: var(--fc-ink);
    color: var(--fc-on-ink);
}

.fc-btn--primary:hover:not(:disabled) {
    background: #302d29;
}

.fc-btn--accent {
    background: var(--fc-accent);
    color: #fff;
}

.fc-btn--accent:hover:not(:disabled) {
    background: var(--fc-accent-hover);
}

.fc-btn--secondary {
    background: var(--fc-surface);
    border-color: var(--fc-line-strong);
    color: var(--fc-ink);
}

.fc-btn--secondary:hover:not(:disabled) {
    background: var(--fc-surface-2);
    border-color: var(--fc-ink-4);
}

.fc-btn--ghost {
    color: var(--fc-ink-2);
}

.fc-btn--ghost:hover:not(:disabled) {
    background: var(--fc-surface-2);
    color: var(--fc-ink);
}

.fc-btn--lg {
    min-height: 48px;
    padding: 0 var(--fc-6);
    font-size: var(--fc-text-md);
}

.fc-btn--sm {
    min-height: 32px;
    padding: 0 var(--fc-3);
    font-size: var(--fc-text-sm);
}

.fc-btn--block {
    width: 100%;
}

/* ==========================================================================
   Form controls
   ========================================================================== */

.fc-field {
    display: flex;
    flex-direction: column;
    gap: var(--fc-1);
}

.fc-label {
    font-size: var(--fc-text-sm);
    font-weight: 550;
    color: var(--fc-ink-2);
}

.fc-input,
.fc-select,
.fc-textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px var(--fc-3);
    background: var(--fc-surface);
    border: 1px solid var(--fc-line-strong);
    border-radius: var(--fc-r-sm);
    color: var(--fc-ink);
    font-size: var(--fc-text-base);
    transition: border-color var(--fc-fast), box-shadow var(--fc-fast);
    appearance: none;
}

.fc-textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.5;
}

.fc-select {
    padding-right: var(--fc-8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a857d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--fc-3) center;
    cursor: pointer;
}

.fc-input:hover,
.fc-select:hover,
.fc-textarea:hover {
    border-color: var(--fc-ink-4);
}

.fc-input:focus,
.fc-select:focus,
.fc-textarea:focus {
    outline: none;
    border-color: var(--fc-accent);
    box-shadow: 0 0 0 3px var(--fc-accent-soft);
}

.fc-input::placeholder,
.fc-textarea::placeholder {
    color: var(--fc-ink-4);
}

.fc-help {
    font-size: var(--fc-text-sm);
    color: var(--fc-ink-3);
}

.fc-error {
    display: flex;
    align-items: flex-start;
    gap: var(--fc-2);
    padding: var(--fc-3);
    background: var(--fc-neg-soft);
    border: 1px solid rgba(176, 63, 54, 0.2);
    border-radius: var(--fc-r-sm);
    color: var(--fc-neg);
    font-size: var(--fc-text-sm);
}

/* Segmented control — replaces ad-hoc toggle buttons */
.fc-segmented {
    display: inline-flex;
    padding: 3px;
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-r-sm);
    gap: 2px;
}

.fc-segmented__item {
    min-height: 32px;
    padding: 0 var(--fc-4);
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--fc-ink-2);
    font-size: var(--fc-text-sm);
    font-weight: 550;
    cursor: pointer;
    transition: background var(--fc-fast), color var(--fc-fast),
        box-shadow var(--fc-fast);
}

.fc-segmented__item:hover {
    color: var(--fc-ink);
}

.fc-segmented__item[aria-selected="true"],
.fc-segmented__item.active {
    background: var(--fc-surface);
    color: var(--fc-ink);
    box-shadow: var(--fc-shadow-sm);
}

/* ==========================================================================
   Surfaces — card, panel, tag
   ========================================================================== */

.fc-card {
    background: var(--fc-surface);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-r);
    padding: var(--fc-4);
}

.fc-card--flush {
    padding: 0;
    overflow: hidden;
}

.fc-card--link {
    display: block;
    transition: border-color var(--fc-mid), box-shadow var(--fc-mid),
        transform var(--fc-mid);
}

.fc-card--link:hover {
    border-color: var(--fc-line-strong);
    box-shadow: var(--fc-shadow-lg);
    transform: translateY(-2px);
}

.fc-panel {
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-r);
    padding: var(--fc-4);
}

.fc-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--fc-1);
    padding: 3px 9px;
    border-radius: var(--fc-r-full);
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-line);
    font-size: var(--fc-text-xs);
    font-weight: 550;
    color: var(--fc-ink-2);
}

.fc-tag--accent {
    background: var(--fc-accent-soft);
    border-color: var(--fc-accent-line);
    color: var(--fc-accent);
}

.fc-tag--pos {
    background: var(--fc-pos-soft);
    border-color: rgba(47, 125, 79, 0.2);
    color: var(--fc-pos);
}

.fc-tag--warn {
    background: var(--fc-warn-soft);
    border-color: rgba(168, 106, 18, 0.2);
    color: var(--fc-warn);
}

.fc-tag--neg {
    background: var(--fc-neg-soft);
    border-color: rgba(176, 63, 54, 0.2);
    color: var(--fc-neg);
}

/* Definition rows — replaces "<p><strong>label:</strong> value</p>" walls */
.fc-defs {
    display: grid;
    gap: 0;
}

.fc-def {
    display: grid;
    grid-template-columns: minmax(88px, 168px) 1fr;
    gap: var(--fc-4);
    padding-block: var(--fc-2);
    border-top: 1px solid var(--fc-line);
    align-items: baseline;
}

.fc-def:first-child {
    border-top: 0;
    padding-top: 0;
}

.fc-def__key {
    font-size: var(--fc-text-sm);
    font-weight: 550;
    color: var(--fc-ink-3);
}

.fc-def__val {
    color: var(--fc-ink);
}

@media (max-width: 560px) {
    .fc-def {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

/* ==========================================================================
   Chat — shared between the stick sites and the Bazi app
   ========================================================================== */

.fc-chat {
    display: flex;
    flex-direction: column;
    background: var(--fc-surface);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-r);
    overflow: hidden;
}

.fc-chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--fc-3);
    padding: var(--fc-3) var(--fc-4);
    border-bottom: 1px solid var(--fc-line);
    background: var(--fc-surface-2);
}

.fc-chat__title {
    font-size: var(--fc-text-base);
    font-weight: 600;
}

.fc-chat__log {
    flex: 1;
    min-height: 200px;
    max-height: 440px;
    overflow-y: auto;
    padding: var(--fc-4);
    display: flex;
    flex-direction: column;
    gap: var(--fc-3);
    scroll-behavior: smooth;
}

.fc-msg {
    display: flex;
    gap: var(--fc-3);
    max-width: 100%;
}

.fc-msg__avatar {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: var(--fc-r-full);
    display: grid;
    place-items: center;
    background: var(--fc-accent-soft);
    color: var(--fc-accent);
    font-size: var(--fc-text-xs);
    font-weight: 600;
}

.fc-msg__body {
    flex: 1;
    min-width: 0;
    font-size: var(--fc-text-base);
    line-height: 1.6;
    color: var(--fc-ink);
    overflow-wrap: anywhere;
}

.fc-msg__body > * + * {
    margin-top: var(--fc-2);
}

.fc-msg__body p {
    margin: 0;
}

.fc-msg__body ul,
.fc-msg__body ol {
    padding-inline-start: var(--fc-5);
    list-style: revert;
}

.fc-msg__body code {
    font-family: var(--fc-font-mono);
    font-size: 0.9em;
    background: var(--fc-surface-2);
    padding: 1px 5px;
    border-radius: 4px;
}

.fc-msg--user .fc-msg__avatar {
    background: var(--fc-surface-3);
    color: var(--fc-ink-2);
}

.fc-msg--user .fc-msg__body {
    background: var(--fc-surface-2);
    border: 1px solid var(--fc-line);
    border-radius: var(--fc-r-sm);
    padding: var(--fc-3);
    color: var(--fc-ink-2);
}

.fc-chat__suggest {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fc-2);
    padding: 0 var(--fc-4) var(--fc-3);
}

.fc-chat__foot {
    display: flex;
    gap: var(--fc-2);
    align-items: flex-end;
    padding: var(--fc-3) var(--fc-4);
    border-top: 1px solid var(--fc-line);
    background: var(--fc-surface);
}

.fc-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding-top: var(--fc-2);
}

.fc-typing span {
    width: 5px;
    height: 5px;
    border-radius: var(--fc-r-full);
    background: var(--fc-ink-4);
    animation: fc-bounce 1.2s infinite ease-in-out;
}

.fc-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.fc-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes fc-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */

.fc-chat__log::-webkit-scrollbar,
.fc-scroll::-webkit-scrollbar {
    width: 10px;
}

.fc-chat__log::-webkit-scrollbar-thumb,
.fc-scroll::-webkit-scrollbar-thumb {
    background: var(--fc-line-strong);
    border-radius: var(--fc-r-full);
    border: 3px solid var(--fc-surface);
}

.fc-chat__log::-webkit-scrollbar-track,
.fc-scroll::-webkit-scrollbar-track {
    background: transparent;
}

/* ==========================================================================
   Entrance motion
   ========================================================================== */

@keyframes fc-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fc-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fc-rise {
    animation: fc-rise var(--fc-slow) both;
}

.fc-rise-1 { animation-delay: 40ms; }
.fc-rise-2 { animation-delay: 80ms; }
.fc-rise-3 { animation-delay: 120ms; }
.fc-rise-4 { animation-delay: 160ms; }
