/* Sistema de diseño de la app de entrenamiento (prefijo ds-).
   Identidad tomada de dermatoivanatrama.com.ar: crema cálido, marrón topo,
   tipografía liviana y esquinas casi rectas. Convive con coaching.css y
   knowledge-workspace.css hasta que cada pantalla migre.
   Fuentes alojadas localmente en /fonts (Switzer: ITF FFL; Mrs Saint Delafield: OFL). */

@font-face {
    font-family: "Switzer Variable";
    src: url("/fonts/Switzer-Variable.woff2") format("woff2-variations"), url("/fonts/Switzer-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mrs Saint Delafield";
    src: url("/fonts/mrs-saint-delafield-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Superficies: crema de la web de Ivana */
    --ds-bg: #f6f3e9;
    --ds-surface: #fcfbf7;
    --ds-surface-alt: #ebe6d6;
    --ds-line: #ddd6c4;
    --ds-line-strong: #b9ae9b;

    /* Texto (AA sobre --ds-bg y --ds-surface) */
    --ds-ink: #3b342d;
    --ds-ink-soft: #5e544b;
    --ds-ink-faint: #6f645a;

    /* Acento: topo de la marca (#786c61) y su versión oscura para texto */
    --ds-accent: #786c61;
    --ds-accent-hover: #5e544b;
    --ds-accent-soft: #ece6da;
    --ds-accent-ink: #5e544b;
    --ds-accent-light: #a39383;

    /* Estados: siempre con texto, nunca solo color */
    --ds-published: #4e6046;
    --ds-published-soft: #e5ead9;
    --ds-draft: #7c5a1e;
    --ds-draft-soft: #f3e6c4;
    --ds-changes: #8c4f3e;
    --ds-changes-soft: #f1ddd3;
    --ds-info: #4a5f6b;
    --ds-info-soft: #e1e8e8;
    --ds-error: #9b2c2c;
    --ds-error-soft: #f5dcd8;

    /* Tipografía */
    --ds-font-body: "Switzer Variable", Switzer, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --ds-font-script: "Mrs Saint Delafield", "Snell Roundhand", cursive;
    --ds-weight-body: 400;
    --ds-weight-display: 300;
    --ds-text-xs: .8125rem;   /* 13px: ayudas y metadatos */
    --ds-text-sm: .9375rem;   /* 15px */
    --ds-text-md: 1rem;       /* 16px: cuerpo */
    --ds-text-lg: 1.1875rem;  /* 19px */
    --ds-text-xl: 1.625rem;   /* 26px */
    --ds-text-2xl: clamp(2rem, 1.5rem + 2vw, 3rem);

    /* Espaciado y forma: la web usa esquinas rectas, acá apenas suavizadas */
    --ds-space-1: .25rem;
    --ds-space-2: .5rem;
    --ds-space-3: .75rem;
    --ds-space-4: 1rem;
    --ds-space-5: 1.5rem;
    --ds-space-6: 2.25rem;
    --ds-space-7: 3.5rem;
    --ds-radius: 4px;
    --ds-radius-sm: 3px;
    --ds-radius-pill: 999px;
    --ds-shadow: 0 1px 0 rgba(59, 52, 45, .04);
    --ds-focus: 0 0 0 2px var(--ds-bg), 0 0 0 4px #4a5f6b;
    --ds-measure: 44rem; /* ancho de lectura */
    --ds-touch: 44px;
}

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

.ds-root {
    margin: 0;
    color: var(--ds-ink);
    background: var(--ds-bg);
    font-family: var(--ds-font-body);
    font-size: var(--ds-text-md);
    font-weight: var(--ds-weight-body);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.ds-root h1, .ds-root h2, .ds-root h3 { margin: 0 0 var(--ds-space-3); color: var(--ds-accent); font-family: var(--ds-font-body); font-weight: var(--ds-weight-display); line-height: 1.15; letter-spacing: -.015em; }
.ds-root h1 { font-size: var(--ds-text-2xl); }
.ds-root h2 { font-size: var(--ds-text-xl); }
.ds-root h3 { font-size: var(--ds-text-lg); font-weight: 400; letter-spacing: 0; }
.ds-root p { margin: 0 0 var(--ds-space-3); }
.ds-root :where(a) { color: var(--ds-accent-ink); text-underline-offset: 3px; }
.ds-root :where(a):hover { color: var(--ds-ink); }

/* Foco visible en toda la app */
.ds-root :focus-visible { outline: none; box-shadow: var(--ds-focus); border-radius: var(--ds-radius-sm); }

.ds-lead { max-width: var(--ds-measure); color: var(--ds-ink-soft); font-size: var(--ds-text-lg); font-weight: 300; }
.ds-meta { color: var(--ds-ink-faint); font-size: var(--ds-text-xs); }
.ds-eyebrow { margin: 0 0 var(--ds-space-2); color: var(--ds-ink-faint); font-size: var(--ds-text-xs); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.ds-rule { width: 3.5rem; height: 1px; margin: var(--ds-space-4) 0; border: 0; background: var(--ds-accent-light); }
.ds-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Layout: columna de lectura */
.ds-page { width: 100%; max-width: 62rem; margin: 0 auto; padding: var(--ds-space-6) clamp(1rem, 4vw, 2.5rem) var(--ds-space-7); }
.ds-page--narrow { max-width: var(--ds-measure); }
.ds-stack > * + * { margin-top: var(--ds-space-4); }
.ds-stack--lg > * + * { margin-top: var(--ds-space-6); }
.ds-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3); }
.ds-row--between { justify-content: space-between; }
.ds-grid { display: grid; gap: var(--ds-space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }

/* Tarjeta: un único estilo, plano y con borde fino */
.ds-card { padding: var(--ds-space-5); border: 1px solid var(--ds-line); border-radius: var(--ds-radius); background: var(--ds-surface); box-shadow: var(--ds-shadow); }
.ds-card--flat { box-shadow: none; }
.ds-card--muted { background: var(--ds-surface-alt); border-color: transparent; }
.ds-card--dark { color: var(--ds-bg); border-color: transparent; background: var(--ds-accent); }
.ds-card--dark :where(h1, h2, h3, p, a) { color: var(--ds-bg); }
.ds-card-title { margin: 0 0 var(--ds-space-2); color: var(--ds-ink); font-size: var(--ds-text-lg); font-weight: 400; line-height: 1.3; }

/* Botones: rectos, mayúscula suave, como los de la web */
.ds-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2); min-height: var(--ds-touch); padding: .55rem 1.35rem; border: 1px solid transparent; border-radius: var(--ds-radius-sm); font: inherit; font-size: var(--ds-text-sm); font-weight: 500; letter-spacing: .04em; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.ds-btn--primary { color: #fcfbf7; background: var(--ds-accent); }
.ds-btn--primary:hover { color: #fcfbf7; background: var(--ds-accent-hover); }
.ds-btn--secondary { color: var(--ds-accent-ink); border-color: var(--ds-accent-light); background: transparent; }
.ds-btn--secondary:hover { color: var(--ds-accent-ink); background: var(--ds-accent-soft); border-color: var(--ds-accent); }
.ds-btn--text { padding-inline: .6rem; color: var(--ds-accent-ink); background: transparent; }
.ds-btn--text:hover { color: var(--ds-ink); background: var(--ds-accent-soft); }
.ds-btn--block { width: 100%; }
.ds-btn[disabled], .ds-btn[aria-disabled="true"] { cursor: not-allowed; opacity: .5; }
.ds-btn svg { width: 1.15em; height: 1.15em; flex: none; }

/* Pills de estado */
.ds-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .7rem; border-radius: var(--ds-radius-pill); font-size: var(--ds-text-xs); font-weight: 500; letter-spacing: .02em; line-height: 1.4; white-space: nowrap; }
.ds-pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.ds-pill--published { color: var(--ds-published); background: var(--ds-published-soft); }
.ds-pill--draft { color: var(--ds-draft); background: var(--ds-draft-soft); }
.ds-pill--changes { color: var(--ds-changes); background: var(--ds-changes-soft); }
.ds-pill--info { color: var(--ds-info); background: var(--ds-info-soft); }

/* Avisos con ícono */
.ds-alert { display: flex; gap: var(--ds-space-3); align-items: flex-start; padding: var(--ds-space-3) var(--ds-space-4); border-left: 3px solid currentColor; border-radius: var(--ds-radius-sm); font-size: var(--ds-text-sm); }
.ds-alert > svg { width: 1.25rem; height: 1.25rem; flex: none; margin-top: .15rem; }
.ds-alert p { margin: 0; color: var(--ds-ink); }
.ds-alert--info { color: var(--ds-info); background: var(--ds-info-soft); }
.ds-alert--success { color: var(--ds-published); background: var(--ds-published-soft); }
.ds-alert--warning { color: var(--ds-draft); background: var(--ds-draft-soft); }
.ds-alert--error { color: var(--ds-error); background: var(--ds-error-soft); }

/* Campos: etiqueta arriba, ayuda abajo */
.ds-field { display: grid; gap: var(--ds-space-2); }
.ds-label { font-size: var(--ds-text-sm); font-weight: 500; }
.ds-hint { color: var(--ds-ink-faint); font-size: var(--ds-text-xs); }
.ds-input, .ds-textarea, .ds-select { width: 100%; min-height: var(--ds-touch); padding: .6rem .85rem; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-sm); color: var(--ds-ink); background: var(--ds-surface); font: inherit; font-size: var(--ds-text-md); }
.ds-textarea { min-height: 9rem; resize: vertical; }
.ds-input:hover, .ds-textarea:hover, .ds-select:hover { border-color: var(--ds-ink-faint); }
.ds-input:focus-visible, .ds-textarea:focus-visible, .ds-select:focus-visible { border-color: var(--ds-info); }
.ds-input[aria-invalid="true"], .ds-textarea[aria-invalid="true"] { border-color: var(--ds-error); }
.ds-check { display: flex; gap: var(--ds-space-3); align-items: flex-start; font-size: var(--ds-text-sm); }
.ds-check input { width: 1.25rem; height: 1.25rem; margin-top: .15rem; flex: none; accent-color: var(--ds-accent); }

/* Progreso real de 3 pasos: son enlaces, no etiquetas */
.ds-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--ds-space-2); margin: 0; padding: 0; list-style: none; counter-reset: ds-step; }
.ds-step { counter-increment: ds-step; }
.ds-step > a, .ds-step > span { display: flex; align-items: center; gap: var(--ds-space-2); min-height: var(--ds-touch); padding: .4rem .75rem; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); color: var(--ds-ink-soft); background: var(--ds-surface); font-size: var(--ds-text-sm); text-decoration: none; }
.ds-step > a::before, .ds-step > span::before { content: counter(ds-step); display: grid; place-items: center; width: 1.6rem; height: 1.6rem; flex: none; border-radius: 50%; color: var(--ds-ink-soft); background: var(--ds-surface-alt); font-size: var(--ds-text-xs); }
.ds-step[aria-current="step"] > a, .ds-step[aria-current="step"] > span { color: var(--ds-bg); border-color: var(--ds-accent); background: var(--ds-accent); }
.ds-step[aria-current="step"] > a::before, .ds-step[aria-current="step"] > span::before { color: var(--ds-accent); background: var(--ds-bg); }
.ds-step[data-done] > a::before, .ds-step[data-done] > span::before { content: "\2713"; color: #fff; background: var(--ds-accent); }

/* Estado vacío */
.ds-empty { padding: var(--ds-space-6) var(--ds-space-5); border: 1px dashed var(--ds-line-strong); border-radius: var(--ds-radius); text-align: center; color: var(--ds-ink-soft); }
.ds-empty h3 { color: var(--ds-accent); }

/* Íconos (sprite en /ds-icons.svg), trazo fino como la web */
.ds-icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* Navegación: lateral en escritorio, barra inferior en celular */
.ds-shell { min-height: 100vh; }
.ds-nav { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--ds-line); background: var(--ds-surface); }
.ds-nav a { display: grid; justify-items: center; gap: .15rem; min-height: var(--ds-touch); padding: .35rem .25rem; border-radius: var(--ds-radius-sm); color: var(--ds-ink-soft); font-size: .75rem; font-weight: 500; letter-spacing: .03em; text-decoration: none; }
.ds-nav a[aria-current="page"] { color: var(--ds-accent-ink); background: var(--ds-accent-soft); }
.ds-shell-main { padding-bottom: 5rem; }

@media (min-width: 62rem) {
    .ds-shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); }
    .ds-nav { position: sticky; inset: 0 auto auto 0; top: 0; align-content: start; grid-template-columns: 1fr; gap: var(--ds-space-1); height: 100vh; padding: var(--ds-space-6) var(--ds-space-4); border-top: 0; border-right: 1px solid var(--ds-line); background: var(--ds-bg); }
    .ds-nav a { grid-auto-flow: column; justify-content: start; gap: var(--ds-space-3); padding: .6rem .8rem; font-size: var(--ds-text-sm); }
    .ds-shell-main { padding-bottom: 0; }
}

@media (max-width: 40rem) {
    .ds-steps { grid-template-columns: 1fr; }
    .ds-card { padding: var(--ds-space-4); }
}

@media (prefers-reduced-motion: reduce) {
    .ds-root *, .ds-root *::before, .ds-root *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Layout compartido (layouts/app.blade.php) */
.ds-brand { display: flex; align-items: center; gap: var(--ds-space-3); color: var(--ds-accent); text-decoration: none; }
.ds-brand-script { font-family: var(--ds-font-script); font-size: 2.35rem; line-height: 1; color: var(--ds-accent); }
.ds-brand-sub { display: block; margin-top: .2rem; padding-top: .35rem; border-top: 1px solid var(--ds-accent-light); color: var(--ds-ink-faint); font-size: .6875rem; letter-spacing: .16em; text-transform: uppercase; }
.ds-topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-3); padding: var(--ds-space-2) clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--ds-line); background: var(--ds-surface); }
.ds-nav .ds-brand, .ds-nav-logout { display: none; }
.ds-page--note { padding-bottom: 0; }
.ds-more { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2) var(--ds-space-4); max-width: 62rem; margin: 0 auto; padding: var(--ds-space-5) clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--ds-line); font-size: var(--ds-text-sm); }
.ds-more a[aria-current="page"] { font-weight: 600; }

@media (min-width: 62rem) {
    .ds-nav .ds-brand { display: block; margin-bottom: var(--ds-space-6); padding: 0 .8rem; }
    .ds-nav-logout { display: block; margin-top: auto; }
    .ds-nav { display: flex; flex-direction: column; align-items: stretch; }
    .ds-topbar { display: none; }
}
