/* ============================================================
 * core.css — page-level shell + form/component compat layer.
 *
 * Layers on top of:
 *   - /assets/css/design-tokens.css   (base tokens)
 *   - /assets/css/site.css            (homepage components, header/footer)
 *
 * Goals:
 *   1. Map legacy --c-* tokens used by inner pages onto new design tokens
 *      so the inline styles in login/dashboard/poll/etc keep working.
 *   2. Restyle .btn, .card, .alert, .input, .field, .tag, .eyebrow so
 *      every inner page inherits the homepage visual language.
 * ============================================================ */

:root {
    /* Legacy aliases — keep inline styles in login/dashboard/etc rendering */
    --c-bg:           var(--surface-1);
    --c-bg-elev:      var(--surface-0);
    --c-bg-sunk:      var(--surface-2);
    --c-border:       var(--border-1);
    --c-border-soft:  var(--border-1);

    --c-ink:          var(--ink-900);
    --c-ink-soft:     var(--ink-700);
    --c-ink-mute:     var(--ink-500);

    --c-brand:        var(--brand-600);
    --c-brand-700:    var(--brand-700);
    --c-brand-300:    var(--brand-400);
    --c-brand-tint:   var(--brand-50);

    --c-accent:       #B91C1C;          /* editör red highlight */
    --c-accent-700:   #991B1B;
    --c-accent-tint:  #FEF2F2;

    --c-ok:           var(--success-500);
    --c-warn:         var(--warning-500);
    --c-err:          var(--danger-600);
    --c-err-tint:     var(--danger-50);

    /* Typography aliases */
    --font-sans:    var(--font-body);
    --font-display: var(--font-display);
    --font-mono:    var(--font-mono);

    --t-step--1: var(--text-sm);
    --t-step-0:  var(--text-base);
    --t-step-1:  var(--text-lg);
    --t-step-2:  var(--text-xl);
    --t-step-3:  var(--text-2xl);
    --t-step-4:  var(--text-3xl);
    --t-step-5:  var(--text-4xl);

    /* Spacing aliases */
    --s-1: var(--space-1);
    --s-2: var(--space-2);
    --s-3: var(--space-3);
    --s-4: var(--space-4);
    --s-5: var(--space-5);
    --s-6: var(--space-6);
    --s-7: var(--space-8);
    --s-8: var(--space-12);
    --s-9: var(--space-16);

    /* Radii aliases (editör tone — sharp) */
    --radius-1: 4px;
    --radius-2: 6px;
    --radius-3: 8px;
    --radius-4: 10px;
    --radius-pill: 999px;

    --shadow-1: var(--shadow-xs);
    --shadow-2: var(--shadow-sm);
    --shadow-3: var(--shadow-md);

    --dur-1: 120ms;
    --dur-2: 220ms;
    --ease-out: var(--ease-out-expo);
}

/* ------------------------------------------------------------
 * Base reset (overrides any older defaults)
 * ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

body {
    background: var(--bg-page);
    color: var(--fg-1);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------
 * Containers
 * ------------------------------------------------------------ */
.container {
    width: min(1180px, 100% - 2 * var(--space-6));
    margin-inline: auto;
}
.container-narrow {
    width: min(640px, 100% - 2 * var(--space-6));
    margin-inline: auto;
}

/* ------------------------------------------------------------
 * Typography — match the homepage
 * ------------------------------------------------------------ */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--ink-900);
    letter-spacing: -0.025em;
    margin: 0;
    text-wrap: balance;
}
h1 { font-size: clamp(28px, 3.6vw, 42px); font-weight: 800; line-height: 1.08; }
h2 { font-size: clamp(24px, 2.6vw, 32px); font-weight: 700; line-height: 1.15; }
h3 { font-size: 20px;  font-weight: 700; line-height: 1.25; }
h4 { font-size: 16px;  font-weight: 700; line-height: 1.3; font-family: var(--font-body); }

p { margin: 0 0 var(--space-3); color: var(--fg-2); }
small, .small { font-size: var(--text-sm); color: var(--fg-3); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }

/* .eyebrow base is supplied by design-tokens.css (brand-color uppercase label).
   For the black gazette-style chip, use .eyebrow.eyebrow--formal from site.css. */

/* ------------------------------------------------------------
 * Section
 * ------------------------------------------------------------ */
.section { padding: 64px 0; position: relative; }
.section--alt { background: var(--surface-0); }

/* ------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-2);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: transform var(--dur-2) var(--ease-out),
                box-shadow var(--dur-2) var(--ease-out);
}
.card.hoverable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.card--feature {
    background:
        linear-gradient(135deg, var(--brand-50) 0%, var(--surface-0) 60%);
}

/* ------------------------------------------------------------
 * Buttons — newspaper sharpness, lacivert gradient
 * ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font: 600 14px var(--font-body);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    background: var(--bg-card);
    color: var(--fg-1);
    transition: transform var(--dur-1) var(--ease-out),
                box-shadow var(--dur-2) var(--ease-out),
                background var(--dur-2),
                border-color var(--dur-2),
                color var(--dur-2);
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--lg, .btn-lg { padding: 14px 22px; font-size: 15px; }
.btn--block, .btn-block { width: 100%; }

.btn--brand, .btn-primary {
    background: var(--grad-brand);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-brand);
}
.btn--brand:hover, .btn-primary:hover { box-shadow: 0 16px 40px rgba(30,58,138,0.4); }

.btn--ghost, .btn-ghost {
    background: transparent;
    color: var(--fg-1);
    border-color: var(--border-2);
}
.btn--ghost:hover, .btn-ghost:hover { background: var(--surface-2); }

.btn--accent {
    background: #B91C1C;
    color: #fff;
}
.btn--accent:hover { background: #991B1B; }

.btn-secondary {
    background: var(--bg-card);
    color: var(--fg-1);
    border-color: var(--border-2);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { box-shadow: var(--shadow-md); }

/* ------------------------------------------------------------
 * Form controls
 * ------------------------------------------------------------ */
.field {
    display: flex; flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.field label { font: 600 13px var(--font-body); color: var(--fg-2); }
.field .hint  { font-size: 12px; color: var(--fg-3); }

.input, .textarea, .select {
    background: var(--bg-card);
    border: 1px solid var(--border-2);
    border-radius: 4px;
    padding: 10px 12px;
    font: 500 15px var(--font-body);
    color: var(--fg-1);
    transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(30,58,138,0.16);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

/* ------------------------------------------------------------
 * Tag / Chip — alias of homepage `.chip`
 * ------------------------------------------------------------ */
.tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    font: 700 11px var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--brand-50);
    color: var(--brand-700);
    border-radius: 999px;
    border: 1px solid transparent;
}
.tag--live {
    background: rgba(239,68,68,0.08);
    color: #B91C1C;
}
.tag--live::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 99px;
    background: #B91C1C;
    animation: oy-pulse-success 2s infinite;
}
.tag--draft  { background: var(--surface-2); color: var(--fg-2); }
.tag--closed { background: var(--ink-100); color: var(--fg-3); }

/* ------------------------------------------------------------
 * Alert
 * ------------------------------------------------------------ */
.alert {
    border: 1px solid var(--border-2);
    border-radius: 4px;
    background: var(--bg-card);
    padding: 12px 14px;
    font: 500 14px var(--font-body);
    color: var(--fg-2);
}
.alert--err {
    background: var(--danger-50);
    border-color: rgba(220,38,38,0.18);
    color: #991B1B;
}
.alert--ok {
    background: var(--success-50);
    border-color: rgba(16,185,129,0.18);
    color: var(--success-700);
}

/* ------------------------------------------------------------
 * Row / Col / grid helpers (kept for inner pages)
 * ------------------------------------------------------------ */
.row  { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.col  { display: flex; flex-direction: column; gap: 12px; }
.between { justify-content: space-between; }
.center  { justify-content: center; align-items: center; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ------------------------------------------------------------
 * Header / Footer markup — IMPORTANT: layout.php uses the
 * homepage `.site-header` styles from site.css. Nothing extra
 * needed here. We just provide the `.skip-link` and dropdown.
 * ------------------------------------------------------------ */
.skip-link {
    position: absolute; left: -9999px;
    background: var(--ink-900); color: #fff;
    padding: 8px 14px;
    border-radius: 0 0 4px 0;
    z-index: 100;
}
.skip-link:focus { left: 0; top: 0; }

.hide-sm { @media (max-width: 640px) { display: none !important; } }

/* ------------------------------------------------------------
 * Print
 * ------------------------------------------------------------ */
@media print {
    .site-header, .site-footer, .btn { display: none !important; }
}

/* ------------------------------------------------------------
 * Reduced motion
 * ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
