/* Portal de clientes · estilos. Tokens de Creative Cycle (solo colores núcleo, superficies claras, logo sobre blanco).
   La marca del cliente vive en sus láminas: el marco del portal se queda neutro para no competir con ella. */

@font-face { font-family: "Apfel Grotezk"; src: url("/fonts/apfel-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Apfel Grotezk"; src: url("/fonts/apfel-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --white: #FFFFFF; --black: #171717; --grey-bg: #F5F5F5;
  --grey-700: #434645; --grey-500: #767F7A; --grey-300: #AFB6B4; --grey-100: #DDDFDE;
  --primary: #FF531F; --cb: #0071CE;

  --font: "Apfel Grotezk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: var(--grey-bg); --surface: var(--white); --ink: var(--black); --ink-2: var(--grey-700);
  --line: var(--grey-100); --field: var(--grey-500); --focus: var(--cb);

  --r-16: 16px; --r-12: 12px; --r-8: 8px; --r-pill: 999px;
  --gutter: 40px; --wide: 1200px; --top: 64px; --nav-w: 300px;
  color-scheme: light;
}
@media (max-width: 1199px) { :root { --gutter: 24px; --nav-w: 264px; } }
@media (max-width: 809px)  { :root { --gutter: 16px; --top: 56px; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.45 var(--font); }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-focusable:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; background: var(--surface); padding: 12px 16px; border-radius: var(--r-12); }
.wrap { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* Tipografía */
.h-l { font: 500 64px/0.95 var(--font); letter-spacing: -0.025em; margin: 0; text-wrap: balance; }
.h-m { font: 500 40px/1 var(--font); letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.h-s { font: 500 22px/1.15 var(--font); letter-spacing: -0.01em; margin: 0; }
.eyebrow { font: 500 13px/1.2 var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 15px; line-height: 1.4; }
.num { font: 500 13px/1 var(--font); letter-spacing: 0; color: var(--grey-500); font-variant-numeric: tabular-nums; }
@media (max-width: 809px) { .h-l { font-size: 40px; } .h-m { font-size: 28px; } .h-s { font-size: 20px; } }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 24px; border-radius: var(--r-pill); border: 1px solid transparent; font: 500 17px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-s { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.btn-dark { background: var(--black); color: var(--white); }
.btn-dark:hover { background: var(--grey-700); }
.btn-line { background: var(--surface); border-color: var(--grey-300); }
.btn-line:hover { border-color: var(--black); }
.btn-meta { color: var(--grey-500); font-size: 14px; }
.btn-text { background: none; border: 0; padding: 8px 0; min-height: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: 500 15px/1 var(--font); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.chip { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: var(--r-pill); font: 500 13px/1 var(--font); background: var(--grey-bg); color: var(--ink-2); white-space: nowrap; }

/* Barra superior: el logo de Creative Cycle siempre sobre blanco */
.top { position: sticky; top: 0; z-index: 40; background: var(--white); border-bottom: 1px solid var(--line); height: var(--top); }
.top-in { height: 100%; display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter); }
.on-home .top-in { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 500 18px/1 var(--font); }
.brand img { width: 24px; height: 24px; }
.brand-sub { color: var(--grey-500); padding-left: 10px; border-left: 1px solid var(--line); }
.top-me { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 15px; }
.top-name { color: var(--ink-2); }
@media (max-width: 809px) { .top-name { display: none; } .brand-sub { display: none; } }

/* Entrar */
.is-login { background: var(--white); }
.login { max-width: 520px; margin: 0 auto; padding: 12vh var(--gutter) 64px; }
.login-brand { display: flex; align-items: center; gap: 10px; font: 500 17px/1 var(--font); margin: 0 0 48px; }
.login-brand img { width: 28px; height: 28px; }
.login-brand span { color: var(--grey-500); padding-left: 10px; border-left: 1px solid var(--line); }
.login .h-l { margin-bottom: 16px; }
.login-lede { margin: 0 0 32px; }
.login-form { display: grid; gap: 16px; margin-bottom: 16px; }
.login form .btn { justify-self: start; }
.field { display: grid; gap: 8px; }
.field-label { font: 500 15px/1 var(--font); }
.field input { min-height: 52px; padding: 12px 16px; border: 1px solid var(--field); border-radius: var(--r-12); background: var(--white); font-size: 17px; }
.field input[aria-invalid="true"] { border-color: #B3330F; }
.login-msg { margin: 0 0 16px; }
.login-msg:empty { margin: 0; }
.login-msg[data-kind="error"] { color: #B3330F; }
.login-msg[data-kind="ok"] { padding: 16px; background: var(--grey-bg); border-radius: var(--r-12); }
.login-help { margin: 32px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }

/* Inicio */
.page-home { padding: 56px 0 96px; }
.home-head { margin-bottom: 40px; display: grid; gap: 12px; }
.guide-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.guide-card { display: grid; background: var(--surface); border-radius: var(--r-16); overflow: hidden; text-decoration: none; border: 1px solid var(--line); transition: border-color .15s; }
.guide-card:hover { border-color: var(--black); }
.guide-card-img { aspect-ratio: 16 / 9; background: var(--grey-100); border-bottom: 1px solid var(--line); }
.guide-card-img img { width: 100%; height: 100%; object-fit: cover; }
.guide-card-body { display: grid; gap: 6px; padding: 20px 24px 24px; }
.empty { background: var(--surface); border-radius: var(--r-16); padding: 40px; display: grid; gap: 8px; justify-items: start; border: 1px solid var(--line); }
.empty-l { padding: 64px 48px; gap: 16px; }
@media (max-width: 809px) { .guide-cards { grid-template-columns: 1fr; } .page-home { padding: 32px 0 64px; } .empty, .empty-l { padding: 32px 24px; } }

/* Guía: menú lateral + contenido */
.guide { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.guide-nav { position: sticky; top: var(--top); height: calc(100vh - var(--top)); display: flex; flex-direction: column; background: var(--white); border-right: 1px solid var(--line); }
.nav-head { position: relative; display: grid; gap: 10px; justify-items: start; padding: 24px 24px 16px; }
.nav-guide { display: grid; gap: 6px; text-decoration: none; }
.nav-guide:hover .nav-title { text-decoration: underline; text-underline-offset: 3px; }
.nav-title { font: 500 22px/1.1 var(--font); letter-spacing: -0.01em; }
.nav-close { display: none; }
.nav-search { padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.nav-search input { width: 100%; min-height: 40px; padding: 8px 14px; border: 1px solid var(--grey-300); border-radius: var(--r-pill); background: var(--grey-bg); font-size: 16px; }
.nav-search input:focus { background: var(--white); }
.nav-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 24px; overscroll-behavior: contain; }
.nav-sections, .nav-pages { list-style: none; margin: 0; padding: 0; }
.nav-sections a { display: grid; grid-template-columns: 34px 1fr; align-items: baseline; gap: 4px; padding: 8px 12px; border-radius: var(--r-8); text-decoration: none; font-size: 15px; line-height: 1.3; }
.nav-sections a:hover { background: var(--grey-bg); }
.nav-sections a[aria-current="page"] { background: var(--black); color: var(--white); }
.nav-sections a[aria-current="page"] .num { color: var(--grey-300); }
.nav-section-link { font-weight: 500; }
.nav-pages { display: none; padding-bottom: 6px; }
.nav-section.is-open .nav-pages, .nav-section.is-search .nav-pages { display: block; }
.nav-pages a { padding-left: 24px; grid-template-columns: 44px 1fr; color: var(--ink-2); }
.nav-noresults { padding: 8px 12px; }
.nav-downloads { display: flex; align-items: center; min-height: 56px; padding: 0 24px; border-top: 1px solid var(--line); text-decoration: none; font-weight: 500; }
.nav-downloads::after { content: "↓"; margin-left: auto; }
.nav-downloads:hover { background: var(--grey-bg); }
.nav-downloads[aria-current="page"] { background: var(--black); color: var(--white); }

.guide-main { min-width: 0; padding: 32px var(--gutter) 96px; }
.guide-bar { display: none; }
.guide-scrim { display: none; }

/* Portada de la guía */
.guide-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 40px; align-items: center; max-width: 1360px; }
.guide-hero-img { border-radius: var(--r-16); overflow: hidden; border: 1px solid var(--line); background: var(--white); }
.guide-hero-body { display: grid; gap: 16px; justify-items: start; }
.guide-intro { margin: 0; max-width: 46ch; }
.guide-hero .btn-row { margin-top: 8px; }
.sections { margin-top: 72px; max-width: 1360px; }
.sections .h-m { margin-bottom: 24px; }
.section-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.section-card { display: grid; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-12); overflow: hidden; height: 100%; align-content: start; }
.section-card:hover { border-color: var(--black); }
.section-card-img { aspect-ratio: 16 / 9; background: var(--grey-100); border-bottom: 1px solid var(--line); }
.section-card-img img { width: 100%; height: 100%; object-fit: cover; }
.section-card-body { display: grid; gap: 6px; padding: 14px 16px 18px; }
@media (max-width: 1199px) { .guide-hero { grid-template-columns: 1fr; gap: 28px; } }

/* Lámina */
.sheet { max-width: 1360px; }
.sheet-head { display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.sheet-head > div:first-child { display: grid; gap: 8px; }
.sheet-head .eyebrow .num { margin-right: 6px; }
.sheet-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet-count { margin-right: 8px; font-variant-numeric: tabular-nums; }
.sheet-figure { margin: 0; }
.sheet-img { display: block; border-radius: var(--r-12); overflow: hidden; border: 1px solid var(--line); background: var(--white); cursor: zoom-in; }
.sheet-img img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
.pager-link { display: grid; gap: 4px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-12); text-decoration: none; font-weight: 500; }
.pager-link:hover { border-color: var(--black); }
.pager-next { text-align: right; }
.pager-hint { margin: 16px 0 0; }
.sheet-tap { display: none; margin-top: 8px; }

/* Paneles: colores, descargas, fuentes */
.panel { margin-top: 24px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-16); }
.panel .h-s { margin-bottom: 6px; }
.panel-note { margin: 0 0 4px; max-width: 80ch; }
.panel > .h-s + .swatches, .panel > .h-s + .files, .panel > .h-s + .fonts { margin-top: 18px; }
.swatches { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 20px; }
.swatch { display: grid; gap: 6px; align-content: start; }
.swatch-chip { height: 88px; border-radius: var(--r-12); border: 1px solid var(--line); margin-bottom: 6px; }
.swatch-name { font-weight: 500; }
.swatch-role { min-height: 2.8em; }
.swatch-group { font: 500 15px/1.2 var(--font); margin: 28px 0 0; color: var(--ink-2); }
.swatch-group + .swatches { margin-top: 12px; }
@media (min-width: 1200px) { .swatches-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.swatch-values { margin: 6px 0 0; display: grid; gap: 2px; }
.swatch-values div { display: grid; grid-template-columns: 1fr; gap: 0; padding-top: 6px; }
.swatch-values dt { font-size: 13px; color: var(--grey-500); }
.swatch-values dd { margin: 0; min-width: 0; }
.copy { width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r-8); padding: 4px 8px; margin-left: -8px; font: 400 15px/1.3 var(--font); font-variant-numeric: tabular-nums; cursor: copy; }
.copy:hover { background: var(--grey-bg); }
.copy:hover::after { content: "Copy"; float: right; font: 500 12px/1.6 var(--font); color: var(--grey-500); }
.files { list-style: none; margin: 18px 0 0; padding: 0; display: grid; }
.file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.file:first-child { border-top: 0; }
.file-preview { width: 96px; height: 64px; border-radius: var(--r-8); background: var(--grey-bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 8px; overflow: hidden; }
.file-preview.is-dark { background: #0000FF; border-color: #0000FF; }
.file-preview.is-black { background: #000000; border-color: #000000; }
.file-preview img { max-width: 100%; max-height: 46px; width: auto; height: auto; }
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.file-body { display: grid; gap: 2px; grid-column: 2; }
.file:not(:has(.file-preview)) .file-body { grid-column: 1 / 3; }
.file-name { font-weight: 500; }
.fonts { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.font { display: grid; gap: 4px; justify-items: start; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-12); }
.font-name { font: 500 24px/1.1 var(--font); margin-bottom: 4px; }
.font .btn { margin-top: 10px; }
.downloads-note { max-width: 70ch; margin: 0 0 8px; }

/* Aviso de copiado */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); background: var(--black); color: var(--white); padding: 12px 20px; border-radius: var(--r-pill); font: 500 15px/1 var(--font); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 60; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Tablet y teléfono: el menú pasa a un panel que se abre con «Contents» */
@media (max-width: 1023px) {
  .guide { grid-template-columns: 1fr; }
  .guide-nav { position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(340px, 88vw); z-index: 50; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; box-shadow: 0 0 0 1px var(--line); }
  .nav-open .guide-nav { transform: none; visibility: visible; transition: transform .2s ease; }
  .nav-close { display: grid; place-items: center; position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border: 1px solid var(--grey-300); border-radius: 50%; background: var(--white); font-size: 24px; line-height: 1; cursor: pointer; }
  .nav-head { padding-right: 64px; }
  .guide-scrim { position: fixed; inset: 0; background: rgba(23, 23, 23, .4); z-index: 45; }
  .nav-open .guide-scrim { display: block; }
  .nav-open { overflow: hidden; }
  .guide-bar { display: flex; align-items: center; gap: 12px; position: sticky; top: var(--top); z-index: 30; margin: -32px calc(-1 * var(--gutter)) 24px; padding: 10px var(--gutter); background: var(--bg); border-bottom: 1px solid var(--line); }
  .guide-bar-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 809px) {
  .guide-main { padding: 24px var(--gutter) 64px; }
  .guide-bar { margin-top: -24px; }
  .sheet-head { align-items: start; }
  .sheet-tools { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sheet-count { grid-column: 1 / -1; margin: 0; }
  .sheet-tap { display: block; }
  .pager { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pager-link { padding: 12px 14px; font-size: 15px; }
  .pager-hint { display: none; }
  .panel { padding: 20px; }
  .swatches { grid-template-columns: 1fr 1fr; gap: 16px; }
  .swatch-role { min-height: 0; }
  .file { grid-template-columns: auto minmax(0, 1fr); }
  .file-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .section-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .section-card-body { padding: 10px 12px 14px; }
  .section-card .h-s { font-size: 17px; }
  .sections { margin-top: 48px; }
}

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