/* =============================================================
   marchernandez.es  ·  Hoja de estilos
   Diseño minimalista, modo oscuro nativo, sin frameworks.
   ============================================================= */

/* ---------- Tokens ---------- */
:root {
    --bg:            #fafafa;
    --bg-elevated:   #ffffff;
    --bg-subtle:     #f3f4f6;
    --border:        #e5e7eb;
    --border-strong: #d1d5db;
    --text:          #0f172a;
    --text-muted:    #4b5563;
    --text-soft:     #6b7280;
    --accent:        #2563eb;
    --accent-hover:  #1d4ed8;
    --accent-soft:   #dbeafe;
    --success:       #16a34a;
    --warning:       #f59e0b;
    --danger:        #dc2626;

    --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.03);
    --shadow:    0 8px 24px rgba(15,23,42,.06), 0 2px 6px rgba(15,23,42,.04);
    --shadow-lg: 0 24px 64px rgba(15,23,42,.10), 0 8px 24px rgba(15,23,42,.06);

    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 22px;

    --container: 1140px;
    --pad-x: clamp(16px, 4vw, 32px);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
    --bg:            #0b0f14;
    --bg-elevated:   #111823;
    --bg-subtle:     #161f2c;
    --border:        #1f2a3a;
    --border-strong: #2a3850;
    --text:          #e6edf6;
    --text-muted:    #a4b1c2;
    --text-soft:     #7a8699;
    --accent:        #60a5fa;
    --accent-hover:  #93c5fd;
    --accent-soft:   #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 10px 30px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.30);
    --shadow-lg: 0 30px 80px rgba(0,0,0,.55), 0 10px 30px rgba(0,0,0,.40);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color .25s ease, color .25s ease;
}
img, svg { max-width: 100%; display: block; }
a {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
p  { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding-left: var(--pad-x);
    padding-right: var(--pad-x);
}

main { flex: 1 0 auto; padding: clamp(2rem, 5vw, 4rem) 0 4rem; }

.muted { color: var(--text-muted); }
.muted.xs { font-size: .82rem; }

.skip-link {
    position: absolute; left: -9999px;
    background: var(--accent); color: #fff;
    padding: .5rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex; align-items: center; gap: 1.5rem;
    height: 64px;
}
.brand {
    display: inline-flex; align-items: center; gap: .65rem;
    color: var(--text); font-weight: 700; letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    box-shadow: var(--shadow-sm);
}
.brand-sm .brand-mark { width: 28px; height: 28px; font-size: .85rem; }

.primary-nav { margin-left: auto; }
.primary-nav ul {
    display: flex; gap: .25rem;
    list-style: none; padding: 0; margin: 0;
}
.primary-nav a {
    color: var(--text-muted);
    padding: .55rem .9rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: .95rem;
    transition: background-color .15s ease, color .15s ease;
}
.primary-nav a:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }
.primary-nav a[aria-current="page"] {
    color: var(--text);
    background: var(--bg-subtle);
}

.header-actions { display: flex; align-items: center; gap: .35rem; }

.icon-btn {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 10px; cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }

#theme-toggle .icon-sun,
#theme-toggle .icon-moon,
#theme-toggle .icon-auto { display: none; }
html[data-theme-pref="light"] #theme-toggle .icon-sun  { display: inline; }
html[data-theme-pref="dark"]  #theme-toggle .icon-moon { display: inline; }
html[data-theme-pref="auto"]  #theme-toggle .icon-auto { display: inline; }

.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: clamp(2rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 4rem);
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute; inset: -30% -10% auto -10%;
    height: 460px;
    background:
        radial-gradient(60% 60% at 30% 50%, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 70%),
        radial-gradient(50% 50% at 80% 30%, color-mix(in srgb, #7c3aed 18%, transparent) 0%, transparent 70%);
    z-index: -1;
    filter: blur(20px);
}
.eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .35rem .7rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .8rem; font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}
.eyebrow .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent); }
    70%  { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.hero h1 .grad {
    background: linear-gradient(135deg, var(--accent), #7c3aed 60%, #ec4899);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.lede {
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    color: var(--text-muted);
    max-width: 62ch;
}

.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .95rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost {
    background: transparent; color: var(--text);
    border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-subtle); }

/* ---------- Sections ---------- */
section { margin-top: clamp(2.5rem, 5vw, 4rem); }
.section-head { margin-bottom: 2rem; }
.section-head h2 { margin-bottom: .35rem; }
.section-head p  { color: var(--text-muted); margin: 0; }

/* ---------- Cards ---------- */
.grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    display: flex; flex-direction: column; gap: .75rem;
    text-decoration: none; color: var(--text);
    position: relative;
}
.card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
}
.card h3 { margin: 0; font-size: 1.1rem; }
.card p  { margin: 0; color: var(--text-muted); font-size: .95rem; }
.card .card-foot {
    margin-top: auto; padding-top: .75rem;
    display: flex; align-items: center; justify-content: space-between;
    font-size: .85rem; color: var(--text-soft);
}
.card-tag {
    display: inline-flex; align-items: center;
    padding: .25rem .55rem;
    font-size: .72rem; font-weight: 600;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
}
.card-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--accent);
}
.card-icon svg { width: 22px; height: 22px; }

.link-list {
    display: grid; gap: .5rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    list-style: none; padding: 0; margin: 0;
}
.link-list a {
    display: flex; align-items: center; justify-content: space-between;
    padding: .7rem .9rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-weight: 500;
    transition: border-color .15s, background .15s, transform .15s;
}
.link-list a:hover {
    border-color: var(--border-strong);
    background: var(--bg-subtle);
    text-decoration: none;
    transform: translateX(2px);
}
.link-list a::after {
    content: "→";
    color: var(--text-soft);
    transition: transform .15s ease, color .15s ease;
}
.link-list a:hover::after { color: var(--accent); transform: translateX(2px); }

/* ---------- Project detail blocks ---------- */
.project-block {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 3vw, 2.25rem);
    margin-bottom: 1.5rem;
}
.project-block h2 { display: flex; align-items: center; gap: .75rem; }
.project-block .lede { margin-bottom: 1.5rem; }

/* ---------- Forms / inputs ---------- */
.input, .select, .textarea {
    width: 100%;
    padding: .65rem .85rem;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
label { display: block; font-weight: 500; margin-bottom: .35rem; }
.form-row { margin-bottom: 1rem; }

/* ---------- Contact ---------- */
.contact-grid {
    display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.contact-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.contact-card .card-icon { margin: 0 auto .75rem; }
.contact-card a { font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
    margin-top: auto;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
}
.footer-inner {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 2rem;
}
.footer-col h4 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-soft);
    margin-bottom: .85rem;
}
.footer-col ul {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: .45rem;
}
.footer-col a { color: var(--text-muted); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    display: flex; justify-content: space-between; flex-wrap: wrap;
    color: var(--text-soft); font-size: .82rem;
}
.footer-bottom a { color: var(--text-soft); }

/* ---------- Legal pages ---------- */
.legal {
    max-width: 800px; margin: 0 auto;
}
.legal h2 { margin-top: 2.5rem; }
.legal h3 { margin-top: 1.75rem; color: var(--text); }
.legal p, .legal li { color: var(--text-muted); }
.legal ul { padding-left: 1.25rem; }

/* ---------- Admin ---------- */
.admin-shell { max-width: 1280px; }
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.admin-grid {
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}
.stat .stat-label {
    font-size: .8rem;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-soft);
    margin-bottom: .35rem;
}
.stat .stat-value {
    font-size: 2rem; font-weight: 700; color: var(--text);
    letter-spacing: -.02em;
}
.stat .stat-sub { color: var(--text-muted); font-size: .85rem; }
.stat.live .stat-value { color: var(--success); display: flex; align-items: center; gap: .55rem; }
.stat.live .stat-value::before {
    content: ""; width: 10px; height: 10px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
    animation: pulse 1.6s infinite;
}

.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.25rem;
}
.panel h3 { margin-top: 0; }

.table {
    width: 100%; border-collapse: collapse;
    font-size: .92rem;
}
.table th, .table td {
    padding: .65rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    text-transform: uppercase; letter-spacing: .05em;
    font-size: .72rem; color: var(--text-soft);
    font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.bar {
    height: 6px; background: var(--bg-subtle); border-radius: 999px; overflow: hidden;
}
.bar > span {
    display: block; height: 100%;
    background: linear-gradient(90deg, var(--accent), #7c3aed);
}

.login-shell {
    min-height: 70vh;
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%; max-width: 380px;
    box-shadow: var(--shadow);
}
.alert {
    padding: .75rem 1rem;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    color: var(--danger);
    font-size: .9rem;
    margin-bottom: 1rem;
}

/* ---------- 404 ---------- */
.notfound {
    text-align: center;
    padding: 5rem 0 4rem;
}
.notfound .code {
    font-size: clamp(5rem, 18vw, 10rem);
    font-weight: 900; letter-spacing: -.05em; line-height: 1;
    background: linear-gradient(135deg, var(--accent), #7c3aed, #ec4899);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
    .nav-toggle { display: inline-flex; }
    .primary-nav {
        position: absolute; top: 64px; left: 0; right: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        padding: .75rem var(--pad-x);
        display: none;
    }
    .primary-nav.open { display: block; }
    .primary-nav ul { flex-direction: column; gap: 0; }
    .primary-nav a { padding: .75rem .9rem; display: block; }
    .header-inner { position: relative; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
