/* Shared frrazers.com design system for tools.frrazers.com */

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

:root {
  color-scheme: light dark;
  --paper: #faf9f5;
  --paper-press: #f0eee7;
  --ink: #191813;
  --muted: #6f6d64;
  --hairline: #e4e2d8;
  --green: #15803d;
  --danger: #b91c1c;
  --check-a: #ffffff;
  --check-b: #dedcd3;
  --shadow: 0 4px 16px rgba(25, 24, 19, 0.08);
  --sans: "Stack Sans Headline", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
}

/* default follows the browser; an explicit data-theme choice wins */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #171611;
    --paper-press: #211f18;
    --ink: #f0eee6;
    --muted: #9a978a;
    --hairline: #2c2a22;
    --green: #4ade80;
    --danger: #f87171;
    --check-a: #2a2724;
    --check-b: #211f1d;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171611;
  --paper-press: #211f18;
  --ink: #f0eee6;
  --muted: #9a978a;
  --hairline: #2c2a22;
  --green: #4ade80;
  --danger: #f87171;
  --check-a: #2a2724;
  --check-b: #211f1d;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  color-scheme: light;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* theme-toggle wipe: disable the default crossfade so the circular
   clip-path animation on the new snapshot is the whole effect */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* ── micro-animations ─────────────────────────────── */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
    transition-duration: 0.001s !important;
  }
}

/* ── logo mark ────────────────────────────────────── */

.mark {
  display: block;
  width: 40px;
  height: auto;
  fill: var(--ink);
  overflow: visible;
  transform-box: fill-box;
  transform-origin: center bottom;
}

.mark .dot {
  transform-box: fill-box;
  transform-origin: center;
}

a:has(> .mark) {
  display: block;
  line-height: 0;
}

/* compact mark for tool headers; masked so it follows the theme color */
a.home {
  display: block;
  line-height: 0;
  flex: none;
}

a.home:hover .mark-img {
  background: var(--muted);
}

.mark-img {
  display: block;
  width: 26px;
  height: 26px;
  background: var(--ink);
  -webkit-mask: url(logo.svg) no-repeat center / contain;
  mask: url(logo.svg) no-repeat center / contain;
  transition: background 0.12s ease, transform 0.18s cubic-bezier(0.3, 1.2, 0.4, 1);
  transform-origin: center bottom;
}

a.home:hover .mark-img {
  transform: scale(1.08);
}

a.home:active .mark-img {
  transform: scale(1.1, 0.88);
}

/* ── theme toggle + icon buttons ──────────────────── */

.theme-toggle,
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.theme-toggle:hover,
.icon-link:hover {
  background: var(--ink);
  color: var(--paper);
}

.theme-toggle svg,
.icon-link svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
  transition: transform 0.25s cubic-bezier(0.3, 1.2, 0.4, 1);
}

.theme-toggle:hover svg {
  transform: rotate(-18deg);
}

.icon-link:hover svg {
  transform: scale(1.12);
}
