/*
 * Shared design layer, loaded after each page's own styles.
 * iOS-style: system font, grouped background with white inset cards,
 * regular/semibold weights, one saffron tint for links and actions.
 * Selectors start with `html` so they win over Tailwind's runtime utilities.
 */

:root {
    --background: #f2f2f7;
    --surface: #ffffff;
    --surface-pressed: #e5e5ea;
    --foreground: #1c1c1e;
    --accent: #6e6e73;
    --border: rgba(60, 60, 67, 0.16);
    --tint: #c2410c;
    --tint-soft: rgba(194, 65, 12, 0.1);
    --header-bg: rgba(242, 242, 247, 0.82);
    --good: #248a3d;
    --neutral: #b25000;
    --bad: #d70015;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}


/* ── Base type ─────────────────────────────────────────────────────────── */

html body {
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    letter-spacing: -0.01em;
    background-color: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html .font-light { font-weight: 400; }
html h1.font-light, html h1 { font-weight: 700; }
html h2.font-light, html h3.font-light { font-weight: 600; }
html strong, html .font-medium { font-weight: 600; }

html h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 2.625rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.12;
}

html h2 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
html h2.text-2xl { font-size: 1.375rem; }
html h2.text-xl { font-size: 1.0625rem; }
html h2.text-lg, html h3.text-lg { font-size: 1.0625rem; }
html h3 { font-weight: 600; letter-spacing: -0.01em; }

html .text-lg { font-size: 1.0625rem; line-height: 1.55; }
html .text-sm { font-size: 0.9375rem; }
html .text-xs { font-size: 0.8125rem; }

/* Subtitle under page titles */
html header > p.text-lg,
html header > p.text-xl,
html .article-description { color: var(--accent); }

/* Quick, quiet entrance instead of a slide */
html .fade-in { animation: siteFade 0.25s ease-out; }
@keyframes siteFade { from { opacity: 0; } to { opacity: 1; } }

/* ── Site header: sticky, translucent ─────────────────────────────────── */

html .site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background-color: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--border) !important;
    animation: none;
}
html .site-header .site-logo { font-weight: 600; letter-spacing: -0.02em; }
html .site-header nav a.hidden { font-weight: 500; }

/* ── Cards: grouped inset lists ───────────────────────────────────────── */

html .rounded-xl.border,
html .border.rounded-xl,
html .not-prose.border {
    background-color: var(--surface);
    border-color: transparent !important;
    border-radius: 14px;
}
html a.rounded-xl.border { transition: background-color 0.15s; }
html a.rounded-xl.border:hover,
html a.rounded-xl.border:active { background-color: var(--surface-pressed); opacity: 1; }

/* Separators inside cards stay as hairlines */
html .rounded-xl .border-b,
html .rounded-xl .border-t,
html .rounded-xl tr.border-t { border-color: var(--border) !important; }

/* Pills and chips */
html .rounded-full.border {
    background-color: var(--surface);
    border-color: transparent !important;
    font-weight: 500;
}
html a.rounded-full.border:hover { background-color: var(--surface-pressed); opacity: 1; }

/* Primary buttons (filled) */
html .btn-primary,
html a.rounded-full[style*="background-color: var(--foreground)"] {
    background-color: var(--tint) !important;
    color: #ffffff !important;
    font-weight: 600;
}

/* Data rows used on panchang and calendar pages */
html .data-row { border-color: var(--border); }
html .data-row strong, html .data-row h2 { font-weight: 600; }

/* ── Links ────────────────────────────────────────────────────────────── */

/* Panchang values link to the glossary: keep them in the text colour */
html .data-row a.underline {
    color: inherit !important;
    text-decoration-color: var(--border);
}
html .data-row a.underline:hover { text-decoration-color: currentColor; }

html main a.underline,
html .prose a {
    color: var(--tint) !important;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.15s;
}
html main a.underline:hover,
html .prose a:hover { text-decoration-color: currentColor; }

/* ── Article prose ────────────────────────────────────────────────────── */

html .prose { font-size: 1.0625rem; }
html .prose p,
html .prose li { line-height: 1.65; color: var(--foreground); }
html .prose h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-top: 2.25rem;
    margin-bottom: 0.625rem;
}
html .prose h3 { font-size: 1.125rem; font-weight: 600; }
html .prose strong { font-weight: 600; }
html .prose .callout {
    background-color: var(--tint-soft);
    border: 0;
    border-radius: 14px;
}
html .prose table {
    background-color: var(--surface);
    border-radius: 14px;
    overflow: hidden;
    font-size: 0.9375rem;
}
html .prose th {
    color: var(--accent);
    font-weight: 500;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
html .prose th, html .prose td { border-color: var(--border); padding: 0.75rem 0.875rem; }
html .prose div[style*="overflow-x"] { border-radius: 14px; margin-bottom: 1.5rem; }
html .prose div[style*="overflow-x"] table { margin-bottom: 0; }

/* Article header rule */
html main hr { border-color: var(--border); }

/* ── Footer ───────────────────────────────────────────────────────────── */

html footer { color: var(--accent); }
html footer nav a { font-weight: 400; }

/* ── Focus visibility ─────────────────────────────────────────────────── */

html a:focus-visible,
html button:focus-visible {
    outline: 2px solid var(--tint);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ── Panchang app (/view): grouped sections ───────────────────────────── */

html .app-group-wrap { margin-bottom: 1.75rem; }
html .app-group-title {
    margin: 0 0 0.5rem 1rem;
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
html .app-group {
    background-color: var(--surface);
    border-radius: 14px;
    overflow: hidden;
}
html .app-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 48px;
    padding: 0.75rem 1rem;
    text-align: left;
}
html .app-row + .app-row { box-shadow: inset 1rem 0.5px 0 var(--surface), inset 0 0.5px 0 var(--border); }
html .app-row-label { color: var(--accent); flex-shrink: 0; }
html .app-row-value { text-align: right; }
html .app-row-value > p:first-child,
html .app-row-strong { font-weight: 600; }
html .app-row-detail { margin-top: 2px; color: var(--accent); font-size: 0.8125rem; }
html .app-accordion button.app-row:active { background-color: var(--surface-pressed); }
html .app-chog-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1rem;
    box-shadow: inset 0 0.5px 0 var(--border);
}
html .app-chog-row.is-current { background-color: var(--tint-soft); }
html .app-chog-row p + p { font-size: 0.8125rem; }
html .app-chog-separator {
    display: flex;
    justify-content: center;
    padding: 0.5rem 1rem;
    box-shadow: inset 0 0.5px 0 var(--border);
}
html .app-event {
    margin-bottom: 1.75rem;
    padding: 0.875rem 1rem;
    border-radius: 14px;
    background-color: var(--tint-soft);
}
html .app-event-label {
    color: var(--tint);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
html .app-event-name { font-size: 1.25rem; font-weight: 600; }

/* Key-fact boxes (label left, value right): list rows with hairlines */
html .not-prose.border > div.flex { padding-top: 0.75rem; padding-bottom: 0.75rem; align-items: baseline; }
html .not-prose.border > div.flex + div.flex { box-shadow: inset 0 0.5px 0 var(--border); }
html .not-prose.border > div.flex > span:first-child { flex: 0 0 auto; max-width: 48%; }
html .not-prose.p-5 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
