/* MarianoOG — component styles. Every value comes from tokens.css.
   Light rule: grey does the work. Blue (key, top-left) and amber (counter,
   bottom-right) appear only where light comes from. */

html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: var(--text-body);
}
::selection { background: rgba(59, 130, 246, 0.35); color: var(--foreground); }

/* ── Button ─────────────────────────────────────────────── */
.og-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 20px;
  font: var(--text-body);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--duration-catch) var(--ease-out),
              border-color var(--duration-catch) var(--ease-out),
              color var(--duration-catch) var(--ease-out),
              box-shadow var(--duration-catch) var(--ease-out);
}
.og-button--sm { min-height: 36px; padding: 0 14px; font: var(--text-small); font-weight: 600; line-height: 1; }
.og-button svg { width: 1.125em; height: 1.125em; flex: none; }

.og-button--primary { background: var(--primary); color: var(--on-primary); }
.og-button--primary:hover { box-shadow: var(--catch); }

.og-button--secondary { background: var(--surface-raised); color: var(--foreground); border-color: var(--border); }
.og-button--secondary:hover { border-color: var(--border-strong); }

.og-button--ghost { background: transparent; color: var(--foreground-muted); }
.og-button--ghost:hover { color: var(--foreground); background: var(--surface); }

.og-button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.og-button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ── Badge ──────────────────────────────────────────────── */
.og-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font: var(--text-eyebrow);
  color: var(--foreground-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.og-badge__dot { width: 6px; height: 6px; border-radius: var(--radius-full); flex: none; }
.og-badge__dot--key { background: var(--blue-400); box-shadow: 0 0 8px 1px rgba(96, 165, 250, 0.7); }
.og-badge__dot--counter { background: var(--counter); box-shadow: 0 0 8px 1px rgba(245, 158, 11, 0.6); }

/* ── Card ───────────────────────────────────────────────── */
.og-card {
  position: relative;
  box-sizing: border-box;
  padding: var(--space-6);
  background: var(--surface);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
}
.og-card--interactive {
  cursor: pointer;
  transition: transform var(--duration-catch) var(--ease-out),
              border-color var(--duration-catch) var(--ease-out),
              box-shadow var(--duration-catch) var(--ease-out);
}
.og-card--interactive:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--lift); }
.og-card--interactive:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* The lit card: the one light source in a view */
.og-card--lit {
  isolation: isolate;
  border-color: transparent;
  background: var(--light-key), var(--light-counter), var(--surface);
}
.og-card--lit::before { /* the light's direction drawn as a hairline */
  content: '';
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: var(--gradient-light);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0.55;
  pointer-events: none;
}
.og-card--lit.og-card--interactive:hover { border-color: transparent; box-shadow: var(--catch); }

/* ── IconTile ───────────────────────────────────────────── */
.og-icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  color: var(--foreground);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.og-icon-tile svg { width: 20px; height: 20px; }
.og-icon-tile--key { color: var(--blue-400); background: var(--light-key), var(--surface-raised); }
.og-icon-tile--counter { color: var(--counter); background: var(--light-counter), var(--surface-raised); }

/* ── Fields ─────────────────────────────────────────────── */
.og-label { display: block; margin-bottom: var(--space-2); font: var(--text-small); font-weight: 600; color: var(--foreground); }
.og-label__hint { margin-left: 6px; font-weight: 400; color: var(--foreground-muted); }
.og-label__required { margin-left: 2px; color: var(--foreground-muted); }

.og-field {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 14px;
  font: var(--text-body);
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--duration-catch) var(--ease-out), box-shadow var(--duration-catch) var(--ease-out);
}
.og-field::placeholder { color: var(--foreground-muted); }
.og-field:hover { border-color: var(--foreground-muted); }
.og-field:focus { border-color: var(--ring); box-shadow: var(--focus); }
textarea.og-field { resize: vertical; }

/* ── Select ─────────────────────────────────────────────── */
/* Uses .og-field for the well; adds the chevron (grey-500) and room for it. */
.og-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e96' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}
.og-select--sm { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font: var(--text-small); background-size: 16px; background-position: right 12px center; padding-right: 36px; }
.og-select option { background: var(--surface); color: var(--foreground); }

/* ── SegmentedControl ───────────────────────────────────── */
/* Grey only: the chosen segment is raised, never coloured. */
.og-segmented {
  display: inline-flex;
  box-sizing: border-box;
  padding: 3px;
  gap: 3px;
  background: var(--background);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.og-segmented__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 14px;
  font: var(--text-body);
  line-height: 1;
  color: var(--foreground-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--duration-catch) var(--ease-out), background-color var(--duration-catch) var(--ease-out), border-color var(--duration-catch) var(--ease-out);
}
.og-segmented__item svg { width: 18px; height: 18px; flex: none; }
.og-segmented__item:hover { color: var(--foreground); }
.og-segmented__item.is-on { color: var(--foreground); font-weight: 600; background: var(--surface-raised); border-color: var(--border); }
.og-segmented__item:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.og-segmented__item:disabled { opacity: 0.4; cursor: not-allowed; }
.og-segmented--sm .og-segmented__item { min-height: 28px; padding: 0 10px; font: var(--text-small); line-height: 1; }
.og-segmented--sm .og-segmented__item svg { width: 16px; height: 16px; }

/* ── Frame ──────────────────────────────────────────────── */
/* A museum mat in greys. The image keeps its own light; the frame adds none. */
.og-frame { margin: 0; }
.og-frame__mat {
  padding: var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.og-frame--sm .og-frame__mat { padding: var(--space-2); border-radius: var(--radius-sm); }
.og-frame__mat > img,
.og-frame__mat > video,
.og-frame__mat > picture > img,
.og-frame__mat > canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--background);
  border-radius: var(--radius-sm);
  outline: 1px solid var(--border-strong);
  outline-offset: -1px;
}
.og-frame--sm .og-frame__mat > img,
.og-frame--sm .og-frame__mat > video,
.og-frame--sm .og-frame__mat > picture > img,
.og-frame--sm .og-frame__mat > canvas { border-radius: 4px; }
.og-frame__caption { margin-top: var(--space-2); font: var(--text-small); color: var(--foreground-muted); }

/* ── Light & type helpers ───────────────────────────────── */
/* Stage: a section lit from its two corners. One per view. */
.og-stage {
  position: relative;
  background: var(--light-key), var(--light-counter), var(--background);
}
/* The one coloured word on a page */
.og-text-light {
  background: var(--gradient-light);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.og-eyebrow { font: var(--text-eyebrow); letter-spacing: 0.08em; text-transform: uppercase; color: var(--foreground-muted); }
.og-muted { color: var(--foreground-muted); }

/* Emerge: an element comes out of the dark, once. Set --i for a stagger. */
.og-emerge {
  animation: og-emerge var(--duration-emerge) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}
@keyframes og-emerge {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .og-emerge { animation: none; }
  .og-button, .og-card--interactive, .og-field, .og-segmented__item { transition: none; }
}
