/* ============================================================
   calculatorers.com — design tokens
   Subject: physical calculators. Keys, tape, seams, mono digits.
   ============================================================ */

:root {
  --ink:        #1B1F23;
  --paper:      #F7F5F0;
  --paper-dim:  #EFEBE2;
  --orange:     #FF5A1F;
  --sage:       #5B7A6B;
  --line:       #E3E0D8;
  --ink-soft:   #5B5F63;
  --tape:       #14171A;
  --tape-line:  #2A2F34;

  --display: 'Space Grotesk', sans-serif;
  --body:    'Inter', sans-serif;
  --mono:    'JetBrains Mono', monospace;

  --radius: 3px;
  --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- focus & motion ---------- */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

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

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.logo .dot { color: var(--orange); }

.site-nav {
  display: flex;
  gap: 28px;
  font-size: 0.92rem;
  font-weight: 500;
}
.site-nav a {
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  padding-bottom: 4px;
  transition: color .15s, border-color .15s;
}
.site-nav a:hover { color: var(--ink); border-color: var(--orange); }

/* ============================================================
   HERO — the keypad
   ============================================================ */
.hero {
  padding: 64px 0 24px;
  border-bottom: 1px solid var(--line);
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--sage);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  max-width: 14ch;
}

.hero p.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 32px;
}

/* search bar styled like a calculator's entry strip */
.calc-search {
  display: flex;
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius);
  padding: 4px;
  max-width: 520px;
  margin-bottom: 12px;
}
.calc-search input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 14px 16px;
  outline: none;
}
.calc-search input::placeholder { color: #888d92; }
.calc-search button {
  background: var(--orange);
  color: var(--ink);
  border: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 14px 20px;
  border-radius: 2px;
  cursor: pointer;
  transition: filter .15s;
}
.calc-search button:hover { filter: brightness(1.08); }

.hero-count {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.hero-count strong { color: var(--ink); }

/* ============================================================
   KEYPAD GRID — category sections styled as physical key rows
   ============================================================ */
.keypad-section { padding: 48px 0; border-bottom: 1px solid var(--line); }
.keypad-section:last-of-type { border-bottom: none; }

.keypad-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
}

.keypad-header h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.keypad-header h2::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--orange);
  border-radius: 1px;
  display: inline-block;
}

.keypad-count {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.key {
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  position: relative;
}

.key:hover {
  transform: translateY(-2px);
  border-color: var(--orange);
  box-shadow: 0 4px 0 var(--ink);
}

.key-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.key-symbol {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--orange);
  background: var(--ink);
  padding: 3px 8px;
  border-radius: 2px;
  line-height: 1.4;
}

.key-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
}

.key-desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* ============================================================
   CALCULATOR PAGE — input panel + printed tape
   ============================================================ */
.calc-page { padding: 44px 0 80px; }

.breadcrumb {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.breadcrumb a:hover { color: var(--orange); }

.calc-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.calc-title-row .key-symbol { font-size: 1rem; padding: 5px 10px; }

.calc-page h1 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  margin: 0;
  letter-spacing: -0.01em;
}

.calc-page .calc-desc {
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0 0 36px;
}

.calc-body {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

@media (max-width: 760px) {
  .calc-body { grid-template-columns: 1fr; }
}

.calc-input-panel {
  background: var(--paper);
  padding: 32px;
}

.field { margin-bottom: 20px; }
.field:last-of-type { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--ink);
}

.field .hint {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 5px;
}

.field input[type="number"],
.field input[type="text"],
.field input[type="date"],
.field select {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-dim);
  color: var(--ink);
}

.field input:focus, .field select:focus {
  background: #fff;
  border-color: var(--orange);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-group label {
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  padding: 9px 14px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}
.radio-group input { accent-color: var(--orange); }

.btn-calc {
  margin-top: 26px;
  width: 100%;
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  padding: 15px;
  border-radius: 2px;
  cursor: pointer;
  transition: background .15s;
}
.btn-calc:hover { background: var(--orange); color: var(--ink); }

/* ---- the tape (result panel) ---- */
.calc-tape {
  background: var(--tape);
  color: var(--paper);
  padding: 32px;
  font-family: var(--mono);
  position: relative;
}

.calc-tape::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--orange) 0 10px, transparent 10px 20px);
}

.tape-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8b9096;
  margin-bottom: 18px;
}

.tape-result {
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 6px;
  word-break: break-word;
}

.tape-result .unit {
  font-size: 0.5em;
  color: var(--orange);
  margin-left: 6px;
}

.tape-sub {
  font-size: 0.85rem;
  color: #9aa0a6;
  margin-bottom: 24px;
}

.tape-rows { border-top: 1px dashed var(--tape-line); padding-top: 16px; }

.tape-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  padding: 7px 0;
  border-bottom: 1px dashed var(--tape-line);
}
.tape-row:last-child { border-bottom: none; }
.tape-row .k { color: #9aa0a6; }
.tape-row .v { color: #fff; font-weight: 600; }

.tape-empty {
  color: #6b7076;
  font-size: 0.9rem;
  line-height: 1.6;
}

.tape-error {
  background: rgba(255,90,31,0.12);
  border: 1px solid var(--orange);
  color: var(--orange);
  font-size: 0.85rem;
  padding: 12px 14px;
  border-radius: 2px;
  margin-bottom: 16px;
}

/* related calculators */
.related {
  margin-top: 56px;
}
.related h3 {
  font-family: var(--display);
  font-size: 1.1rem;
  margin-bottom: 16px;
}
.related .keypad-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 50px;
  margin-top: 20px;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer p {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0;
}
.site-footer .foot-tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--sage);
}

@media (max-width: 600px) {
  .site-nav { display: none; }
  .field-row { grid-template-columns: 1fr; }
}