/*
 * Nekomiau — Design Tokens & Base
 * ================================
 * CUBE CSS layering used across this project's stylesheets:
 *   1. tokens.css      — this file: custom properties + the Base layer
 *                         (bare-element defaults: body, headings, links,
 *                         forms, tables — no classes required).
 *   2. layout.css       — Composition layer (stack/cluster/grid/container
 *                         primitives) + structural blocks (header, footer,
 *                         hero, homepage/PLP sections).
 *   3. components.css   — Block layer (product-card, cart, forms, buttons,
 *                         flash, admin tables, etc).
 *
 * Fonts are self-hosted (see "Fonts" below, and the bottom of this file for
 * why + a note on what's NOT done yet).
 *
 * Brand reference: Nekomiau brand manual — flat Rothko-style color-field
 * blocking, max 3 colors per composition, never blue/cold-purple, no
 * gradients. "Juguetona pero premium": warm, confident, never childish.
 */

/* ==========================================================================
   Fonts (self-hosted woff2, Google Fonts "Arvo" + "Outfit")
   Files live in app/assets/fonts/ — Propshaft flattens app/assets/* into a
   single logical namespace, so plain filenames below resolve correctly
   without a "../fonts/" prefix.
   ========================================================================== */

@font-face {
  font-family: "Arvo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/arvo-400-8d231293.woff2") format("woff2");
}

@font-face {
  font-family: "Arvo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/arvo-700-43fddec0.woff2") format("woff2");
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/assets/outfit-300-2cc7ac09.woff2") format("woff2");
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/outfit-400-03a2e56b.woff2") format("woff2");
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/outfit-600-4c8f4285.woff2") format("woff2");
}

/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  /* ---- Brand palette (hex values are authoritative, from the brand manual;
     do not reinterpret) -------------------------------------------------- */
  --color-rojo-atun: #C0392B;    /* primary / brand */
  --color-crema-leche: #F4EBD9; /* main background, ~60% of any composition */
  --color-negro-trazo: #1A1614; /* near-black: isotype line art + text */
  --color-ocre-croqueta: #D68C33; /* secondary accent */
  --color-vino-res: #7B2D3A;    /* contrast / premium accent blocks */
  --color-verde-salvia: #6B7A4F; /* ONLY non-warm color allowed — use sparingly, signals "natural" */
  --color-marron-pate: #5C4433; /* dark neutral, alt to near-black on large surfaces */
  --color-arena: #E4D5BC;       /* light neutral: separators / secondary backgrounds */

  /* Raw palette also exposed as plain white/transparent helpers */
  --color-white: #FFFFFF;

  /* ---- Semantic tokens (light theme = default) ------------------------- */
  --bg-primary: var(--color-crema-leche);
  --bg-secondary: var(--color-arena);
  --bg-inverse: var(--color-negro-trazo);
  --surface-raised: var(--color-white);

  --text-primary: var(--color-negro-trazo);
  --text-secondary: var(--color-marron-pate);
  --text-on-brand: var(--color-crema-leche);
  --text-link: var(--color-rojo-atun);

  --border-color: var(--color-arena);
  --border-color-strong: var(--color-marron-pate);

  --brand-primary: var(--color-rojo-atun);
  --brand-secondary: var(--color-ocre-croqueta);
  --brand-contrast: var(--color-vino-res);
  --brand-natural: var(--color-verde-salvia);

  --focus-ring: var(--color-vino-res);

  /* Semantic feedback (kept inside the warm palette; verde-salvia is the only
     cool-signal color available and is reserved for "success/natural") */
  --feedback-success-bg: #E6EADB;   /* tint of verde-salvia */
  --feedback-success-text: var(--color-verde-salvia);
  --feedback-error-bg: #F3DAD6;     /* tint of rojo-atun */
  --feedback-error-text: var(--color-rojo-atun);
  --feedback-notice-bg: var(--color-arena);
  --feedback-notice-text: var(--color-marron-pate);

  /* ---- Typography -------------------------------------------------------
     Arvo (slab serif, headlines/titles) + Outfit (geometric sans, body/UI).
     Brand spec gives sizes in pt; scale below converts to rem (root 16px)
     and keeps within the spec's 34-40pt hero / 15-26pt section ranges and
     8-12pt body/label/legal range. */
  --font-display: "Arvo", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --text-xs: 0.75rem;    /* 12px — legal / fine print (brand: 8-12pt) */
  --text-sm: 0.8125rem;  /* 13px — labels, meta */
  --text-base: 0.9375rem; /* 15px — body copy (brand: 8-12pt ≈ our 13-16px) */
  --text-md: 1.0625rem;  /* 17px — emphasized body / lead paragraphs */
  --text-lg: 1.25rem;    /* 20px — small product/section names (brand: 15-26pt lower end) */
  --text-xl: 1.5rem;     /* 24px — product/section names */
  --text-2xl: 1.75rem;   /* 28px — section names, upper end */
  --text-3xl: 2.25rem;   /* 36px — page titles */
  --text-4xl: 2.75rem;   /* 44px — hero title (brand: 34-40pt lower-mid) */
  --text-5xl: 3.25rem;   /* 52px — hero title, upper end */

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.55;

  /* ---- Spacing (4px grid) ------------------------------------------------ */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */

  /* ---- Radius (flat/bold brand — kept modest, never pill-heavy except
     badges/toggles) --------------------------------------------------------- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* ---- Shadow (used sparingly — brand is flat color-field blocking, not
     skeuomorphic; reserve for floating/sticky UI only) ---------------------- */
  --shadow-sm: 0 1px 2px rgba(26, 22, 20, 0.08);
  --shadow-md: 0 4px 16px rgba(26, 22, 20, 0.16);

  /* ---- Motion (restrained — one deliberate motion per key action; CSS-only
     transform/opacity, no JS animation libraries) --------------------------- */
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 400ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);

  /* ---- Containers -------------------------------------------------------- */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;

  /* ---- Breakpoint reference (documentation only — custom properties are
     not usable inside @media conditions, so these numbers are hardcoded at
     each call site; keep them in sync with this list):
       480px  — large phone
       640px  — small tablet / phablet
       768px  — tablet
       1024px — small desktop
       1280px — desktop
  */
}

/* ==========================================================================
   Base layer — bare elements, no classes required.
   Several existing views (account, admin orders/stock, tracking, checkout
   forms) render plain <table>/<ul>/<form>/<button> without component classes;
   styling the elements directly keeps them on-brand with zero ERB changes.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--text-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

main {
  display: block;
}

ul, ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-6);
}

/* Bare tables (admin lists, account subscriptions/orders) */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-6);
  font-size: var(--text-sm);
}

th, td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-color);
}

th {
  font-family: var(--font-body);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--text-xs);
}

/* Bare forms (auth, subscriptions/new, checkout without .field wrapper) */
label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

input,
select,
textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--surface-raised);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
  width: 100%;
  max-width: 28rem;
}

textarea {
  min-height: 6rem;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  max-width: none;
}

/* Buttons: bare <button>/submit inputs get the same brand treatment as
   .button (components.css) without requiring the class everywhere (e.g. the
   Culqi checkout buttons, admin action buttons). */
button,
input[type="submit"],
input[type="button"] {
  font-family: var(--font-body);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-base);
  color: var(--text-on-brand);
  background-color: var(--brand-primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  background-color: var(--brand-contrast);
}

button:active,
input[type="submit"]:active,
input[type="button"]:active {
  transform: translateY(1px);
}

button:disabled,
input[type="submit"]:disabled {
  background-color: var(--border-color-strong);
  cursor: not-allowed;
  transform: none;
}

/* ---- Accessibility utility (already referenced in ERB) ------------------ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Brand mark utility --------------------------------------------------
   Ready for the hand-drawn isotype asset (deliberately imperfect single-line
   cat) once it lands in app/assets/images — not added to any ERB view yet
   since the asset file doesn't exist in this pass. Defines a consistent
   clear-space frame so a future agent can drop in an <img class="brand-mark">
   or inline <svg class="brand-mark"> without relitigating sizing. */
.brand-mark {
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  padding: var(--space-1);
  color: var(--color-negro-trazo);
}

.brand-mark--lg {
  width: 4.5rem;
  height: 4.5rem;
}
