/* ==========================================================================
   POR.calc — Design tokens & base styles
   Apple-inspired system: SF-style type stack, light/dark token sets.
   ========================================================================== */

:root {
    /* Type */
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
                 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", ui-monospace, "Menlo", "Consolas", monospace;

    /* Spacing scale */
    --space-2: 0.25rem;
    --space-4: 0.5rem;
    --space-6: 0.75rem;
    --space-8: 1rem;
    --space-12: 1.5rem;
    --space-16: 2rem;
    --space-24: 3rem;
    --space-32: 4rem;

    /* Radius */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-full: 999px;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast: 0.15s;
    --dur-med: 0.25s;
    --dur-slow: 0.4s;

    /* ---- Light theme tokens (default) ---- */
    --color-bg: #f5f5f7;
    --color-bg-alt: #ececef;
    --color-surface: rgba(255, 255, 255, 0.74);
    --color-surface-solid: #ffffff;
    --color-surface-raised: #ffffff;

    --color-text: #1d1d1f;
    --color-text-secondary: #6e6e73;
    --color-text-tertiary: #86868b;
    --color-on-accent: #ffffff;

    --color-accent: #0071e3;
    --color-accent-hover: #0077ed;
    --color-accent-active: #0060c2;
    --color-accent-soft: rgba(0, 113, 227, 0.1);

    --color-success: #1f8a3d;
    --color-danger: #d70015;
    --color-danger-soft: rgba(215, 0, 21, 0.08);

    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-strong: rgba(0, 0, 0, 0.14);
    --color-divider: rgba(0, 0, 0, 0.06);

    --color-input-bg: #ffffff;
    --color-input-border: rgba(0, 0, 0, 0.12);
    --color-input-readonly-bg: rgba(0, 0, 0, 0.035);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.12);
    --shadow-focus: 0 0 0 4px var(--color-accent-soft);

    --backdrop-blur: 24px;

    --bg-mesh:
        radial-gradient(circle at 12% -10%, rgba(0, 113, 227, 0.10), transparent 42%),
        radial-gradient(circle at 100% 0%, rgba(88, 86, 214, 0.08), transparent 45%),
        radial-gradient(circle at 50% 100%, rgba(0, 113, 227, 0.06), transparent 50%);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    background-image: var(--bg-mesh);
    background-attachment: fixed;
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
    letter-spacing: -0.01em;
}

body > app-shell {
    width: 100%;
}

h1, h2, h3, p {
    font-family: inherit;
}

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

a:hover {
    text-decoration: underline;
}

::selection {
    background: var(--color-accent-soft);
    color: var(--color-text);
}

/* Scrollbars (WebKit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: content-box;
}

/* Global focus ring */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
.segment:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}

.app-header,
.app-main,
.app-footer {
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
    padding-left: var(--space-16);
    padding-right: var(--space-16);
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
