/*
 * base.css — The Gentle Studio
 * Reset, shared utilities, cursor, grain overlay
 */

/* Font imports live in theme.css, maintained by the Style Editor. */

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

html {
  scroll-behavior: smooth;
  scrollbar-width: none;           /* Firefox */
}
html::-webkit-scrollbar { display: none; } /* Chrome / Safari / Edge */

body {
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-mono);
}

/* Hide the native pointer only on pages that draw their own. The CMS, the
   editors and the login page load this file but have no #cursor element, so
   hiding it there left them with no pointer at all. Every rule below that
   would otherwise say `cursor: none` says `cursor: inherit` instead, so this
   one declaration decides for the whole page. */
body:has(#cursor) { cursor: none; }

/* Placeholder text is a hint, not a value. Left at the browser default it sat
   at the same weight as real input, so an empty field read as a filled one.
   `opacity: 1` because Firefox dims placeholders on top of the colour. */
::placeholder { color: var(--color-placeholder); opacity: 1; }

/* ── Custom Cursor ───────────────────────────────────────── */
#cursor {
  position: fixed;
  width: 8px; height: 8px;
  background: var(--color-ink);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transition: transform var(--duration-fast) ease, opacity 0.2s;
  transform: translate(-50%, -50%);
}
#cursor.hover {
  transform: translate(-50%, -50%) scale(4);
  background: transparent;
  border: 1px solid var(--color-ink);
}

/* ── Grain Overlay ───────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9000;
  opacity: 0.4;
}

/* The `hidden` attribute must beat component display rules — .btn sets
   inline-flex, which would otherwise override the browser default. */
[hidden] { display: none !important; }

/* ── Shared Buttons ──────────────────────────────────────── */
.btn {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  padding: 8px 16px;
  border: 1px solid;
  background: transparent;
  cursor: inherit;
  transition: all var(--duration-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn-primary { background: var(--color-ink); color: var(--color-bg); border-color: var(--color-ink); }
.btn-primary:hover { background: var(--color-accent); border-color: var(--color-accent); }
.btn-light   { border-color: var(--color-border); color: var(--color-accent); }
.btn-light:hover   { background: var(--color-ink); color: var(--color-bg); border-color: var(--color-ink); }
.btn-ghost   { border-color: var(--color-hairline-light); color: var(--color-muted); }
.btn-ghost:hover   { border-color: var(--color-bg); color: var(--color-bg); }
.btn-danger  { border-color: var(--color-border); color: var(--color-muted); }
.btn-danger:hover  { background: var(--color-danger); color: var(--color-surface); border-color: var(--color-danger); }
.btn:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 2px; }
.btn:disabled { opacity: 0.3; pointer-events: none; }

/* ── Fade-in animation ───────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp var(--duration-slow) var(--ease-out) forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* ── Shared section label ────────────────────────────────── */
.label-caps {
  font-size: var(--font-size-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ── Toast ───────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--color-ink); color: var(--color-bg);
  padding: 11px 20px;
  font-size: var(--font-size-xs); letter-spacing: var(--tracking-label); text-transform: uppercase;
  opacity: 0; transform: translateY(8px);
  transition: all 0.22s; pointer-events: none; z-index: 9998;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.err  { background: var(--color-danger); }
