/* ThinkType — Base Design Tokens, Primitives & Global Chrome */
:root {
  --bg: #f4f5f7;
  --bg-deep: #e2e5ea;
  --surface: #ffffff;
  --surface-tint: rgba(255, 255, 255, 0.72);

  --ink: #17130f;
  --ink-soft: #433d35;
  --ink-muted: #5c554c;

  --hl: #f7e33b;
  --teal: #1c9a90;
  --teal-ink: #083f3a;
  --tape: #ece0b8;

  --danger: #b91c1c;
  --danger-tint: rgba(185, 28, 28, 0.11);
  --warn: #92400e;
  --warn-tint: rgba(180, 83, 9, 0.13);

  --marker: 'Permanent Marker', 'Kalam', cursive;
  --hand: 'Kalam', cursive;
  --body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Atkinson Hyperlegible Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --wobble-2: 15px 225px 15px 255px / 255px 15px 225px 15px;
  --wobble-pill: 48% 52% 45% 55% / 55% 45% 52% 48%;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85 .08' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .27 0 0 0 0 .32 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  caret-color: var(--teal-ink);
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 3px solid var(--teal-ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.app-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 36px) 52px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header & Navigation ---------- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--ink);
  margin-bottom: 28px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 4px 6px;
  margin-left: -6px;
  color: var(--ink);
  cursor: pointer;
}

.brand-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  background-color: var(--hl);
  color: var(--ink);
}

.brand-name {
  font-family: var(--marker);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
}

.brand-name i {
  font-style: normal;
  color: var(--teal-ink);
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 20px;
}

.nav-tab {
  background: transparent;
  border: none;
  padding: 4px 2px;
  font-family: var(--hand);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: underline 2.5px transparent;
  text-underline-offset: 0.28em;
  cursor: pointer;
  transition: color 180ms ease, text-decoration-color 220ms ease;
}

.nav-tab:hover {
  color: var(--ink);
  text-decoration-color: rgba(23, 19, 15, 0.35);
}

.nav-tab.is-active {
  color: var(--ink);
  text-decoration-color: var(--teal);
}

.main-stage {
  flex: 1;
}

/* ---------- Marker / Tape Primitives ---------- */
.hl {
  background-image: linear-gradient(100deg, transparent 0 0.4%, var(--hl) 1.2% 98.4%, transparent 99.4%);
  background-size: 100% 78%;
  background-position: 0 64%;
  background-repeat: no-repeat;
  padding: 0 0.14em;
  margin: 0 -0.06em;
  border-radius: 0.3em 0.6em 0.4em 0.7em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.tape,
.btn-primary.taped::before {
  --tape-edge: 5px;
  -webkit-mask:
    linear-gradient(#000 0 0) center / calc(100% - var(--tape-edge) * 2) 100% no-repeat,
    conic-gradient(from 45deg at left, #000 90deg, #0000 0) left / var(--tape-edge) 7px repeat-y,
    conic-gradient(from -135deg at right, #000 90deg, #0000 0) right / var(--tape-edge) 7px repeat-y;
  mask:
    linear-gradient(#000 0 0) center / calc(100% - var(--tape-edge) * 2) 100% no-repeat,
    conic-gradient(from 45deg at left, #000 90deg, #0000 0) left / var(--tape-edge) 7px repeat-y,
    conic-gradient(from -135deg at right, #000 90deg, #0000 0) right / var(--tape-edge) 7px repeat-y;
}

.tape {
  display: inline-block;
  background: var(--tape);
  color: var(--ink);
  padding: 0.28rem 1rem 0.24rem;
  font-family: var(--marker);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 4px rgba(23, 19, 15, 0.14);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 45%, rgba(120, 90, 40, 0.08));
}

/* ---------- Buttons, Inputs & Keycaps ---------- */
.btn-primary {
  --tilt: -1deg;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--marker);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: 0.85rem 1.45rem 0.8rem;
  color: var(--ink);
  background: var(--hl);
  border: 3px solid var(--ink);
  border-radius: var(--wobble);
  box-shadow: 0 8px 14px -8px rgba(23, 19, 15, 0.45), 0 2px 0 rgba(23, 19, 15, 0.22);
  transform: rotate(var(--tilt));
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.btn-primary:hover {
  transform: rotate(calc(var(--tilt) * -1)) translateY(-2px);
  box-shadow: 0 12px 18px -10px rgba(23, 19, 15, 0.5), 0 2px 0 rgba(23, 19, 15, 0.25);
}

.btn-primary:active {
  transform: rotate(0) translateY(1px);
  box-shadow: 0 3px 6px -4px rgba(23, 19, 15, 0.45);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--small {
  font-size: 1rem;
  padding: 0.65rem 1.05rem 0.6rem;
}

.btn-primary.taped {
  position: relative;
}

.btn-primary.taped::before {
  --tape-edge: 4px;
  content: '';
  position: absolute;
  top: -0.6rem;
  right: -0.75rem;
  width: 2.9rem;
  height: 1rem;
  background: var(--tape);
  opacity: 0.94;
  transform: rotate(28deg);
  box-shadow: 0 1px 2px rgba(23, 19, 15, 0.18);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-tint);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--wobble-2);
  font-family: var(--hand);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, transform 160ms var(--ease);
}

.btn-ghost:hover {
  background-color: var(--hl);
  transform: translateY(-1px);
}

.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.text-input {
  flex: 1;
  min-width: 170px;
  padding: 9px 12px;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble-2);
  background-color: var(--bg);
  font-family: var(--body);
  font-size: 0.95rem;
  color: var(--ink);
}

.text-input.is-mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.shortcut-hint {
  font-family: var(--hand);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

kbd {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background-color: var(--surface);
  border: 2px solid var(--ink);
  color: var(--ink);
}
