/* Piecly — Website */

:root {
  --bg: #ffffff;
  --fg: #111;
  --muted: #555;
  --faint: #999;
  --border: #e8e8e8;
  --surface: #f9f9f9;
  --code-bg: #f4f4f4;
  --accent: #1a7a42;
  --accent-bg: #edf7f0;
  --negative: #c0392b;
  --brand-bg: #111;
  --brand-fg: #c9f135;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --container: 1080px;
  --narrow: 660px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
::selection { background: #d4edda; color: var(--fg); }
code { font-family: var(--mono); font-size: 0.88em; }

/* --- Layout --- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: var(--narrow); margin: 0 auto; padding: 0 24px; }

/* --- Typography --- */
h1, h2, h3 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 28px; margin-bottom: 16px; }
p { margin-bottom: 16px; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }

/* --- Buttons --- */
.btn-primary {
  display: inline-block;
  background: var(--fg);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 8px;
  transition: background 0.15s;
}
.btn-primary:hover { background: #333; }
.btn-primary.btn-lg { font-size: 17px; padding: 16px 36px; }
.btn-secondary {
  display: inline-block;
  font-weight: 500;
  font-size: 15px;
  color: var(--muted);
  padding: 12px 4px;
  transition: color 0.15s;
}
.btn-secondary:hover { color: var(--fg); }

/* ======================================================
   Nav
   ====================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.logo-mark {
  width: 28px; height: 28px;
  background: var(--brand-bg);
  color: var(--brand-fg);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--fg); }
.nav-cta {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--fg);
  padding: 8px 18px;
  border-radius: 7px;
  transition: background 0.15s;
}
.nav-cta:hover { background: #333; }

/* ======================================================
   Hero
   ====================================================== */
.hero {
  padding: 150px 0 120px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 64px;
  align-items: center;
}
.hero-text h1 {
  font-size: clamp(34px, 4.5vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.hero-lede {
  font-size: 18px;
  color: var(--muted);
  max-width: 500px;
  margin-bottom: 32px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.hero-meta {
  font-size: 13px;
  color: var(--faint);
  margin: 0;
}

/* --- Overlay demo (hero) --- */
.hero-visual {
  perspective: 900px;
}
.overlay-demo {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  width: 320px;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
  transform: rotateY(-3deg) rotateX(1deg);
  transition: transform 0.4s ease;
  animation: overlayEnter 0.6s 0.3s both ease;
}
.hero-visual:hover .overlay-demo {
  transform: rotateY(0) rotateX(0);
}
@keyframes overlayEnter {
  from { opacity: 0; transform: rotateY(-3deg) rotateX(1deg) translateY(16px); }
  to   { opacity: 1; transform: rotateY(-3deg) rotateX(1deg) translateY(0); }
}

.od-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.od-logo {
  width: 22px; height: 22px;
  background: var(--brand-bg);
  color: var(--brand-fg);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.od-title { font-weight: 700; }
.od-merchant {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}
.od-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 2px;
}
.od-best {
  background: var(--accent-bg);
}
.od-swatch {
  width: 34px; height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
}
.od-amex   { background: #006fcf; }
.od-chase  { background: #1a3c6d; }
.od-capone { background: #d03027; }
.od-citi   { background: #003b70; }
.od-discover { background: #ff6a00; }
.od-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.od-name {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.od-last {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
}
.od-earning {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  flex-shrink: 0;
}
.od-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.od-note {
  margin-top: 10px;
  padding: 10px;
  background: var(--surface);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ======================================================
   How it works
   ====================================================== */
.section-how {
  padding: 120px 0;
  border-top: 1px solid var(--border);
}
.section-how .container-narrow {
  margin-bottom: 40px;
}
.section-how .container-narrow:last-child {
  margin-bottom: 0;
  margin-top: 32px;
}
.section-how .container-narrow p {
  color: var(--muted);
}

/* Calc block */
.calc-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.calc-meta {
  padding: 14px 20px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
}
.calc-merchant { color: var(--fg); }
.calc-category { color: var(--muted); }
.calc-amount { color: var(--fg); font-weight: 600; }
.calc-sep { color: var(--faint); }

.calc-table-wrap { overflow-x: auto; }
.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 14px;
}
.calc-table th {
  text-align: left;
  padding: 12px 20px;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  border-bottom: 1px solid var(--border);
}
.calc-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--muted);
}
.calc-table tbody tr:last-child td { border-bottom: none; }
.calc-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.calc-table tbody tr:hover {
  background: var(--surface);
}
.calc-table .row-selected td {
  color: var(--fg);
  font-weight: 500;
}
.calc-table .row-selected,
.calc-table .row-selected:hover {
  background: var(--accent-bg);
}
.cell-earn { font-weight: 600; color: var(--accent); }

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.dot-amex   { background: #006fcf; }
.dot-chase  { background: #1a3c6d; }
.dot-capone { background: #d03027; }
.dot-citi   { background: #003b70; }

.calc-explain {
  color: var(--muted);
  font-size: 16px;
  transition: opacity 150ms ease;
}
.calc-explain.fading {
  opacity: 0;
}

/* ======================================================
   Setup
   ====================================================== */
.section-setup {
  padding: 120px 0;
  border-top: 1px solid var(--border);
}
.setup-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 72px;
  align-items: start;
}
.setup-text p { color: var(--muted); }
.setup-issuers {
  font-size: 14px;
  color: var(--faint);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* Panel demo */
.panel-demo {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-size: 13px;
  width: 320px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}
.pd-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.pd-title { font-weight: 700; }
.pd-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.pd-card:last-of-type { border-bottom: none; }
.pd-inactive { opacity: 0.45; }
.pd-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pd-name { font-weight: 600; font-size: 12px; }
.pd-rates { font-size: 11px; color: var(--faint); font-family: var(--mono); }

.pd-toggle {
  width: 36px; height: 20px;
  border-radius: 10px;
  background: #ccc;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.pd-toggle.on { background: var(--accent); }
.pd-knob {
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.pd-toggle.on .pd-knob { left: 18px; }

.pd-footer {
  display: flex;
  gap: 16px;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.pd-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: default;
}

/* ======================================================
   Detection & Privacy
   ====================================================== */
.section-privacy {
  padding: 120px 0;
  border-top: 1px solid var(--border);
}
.privacy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: start;
}
.privacy-text p { color: var(--muted); }
.privacy-link {
  font-size: 14px;
  color: var(--faint);
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.privacy-link a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.privacy-link a:hover { color: var(--fg); }

.privacy-details {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.privacy-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}
.privacy-col h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-bottom: 16px;
}
.privacy-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.privacy-col li {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
  color: var(--muted);
}
.privacy-col li::before {
  flex-shrink: 0;
  font-size: 11px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}
.privacy-yes::before {
  content: "✓";
  color: var(--accent);
  background: var(--accent-bg);
}
.privacy-neutral::before {
  content: "—";
  color: var(--faint);
  background: var(--surface);
  border: 1px solid var(--border);
}
.privacy-no::before {
  content: "✗";
  color: var(--negative);
  background: #fdf0ef;
}

/* ======================================================
   Good to know
   ====================================================== */
.section-edges {
  padding: 120px 0;
  border-top: 1px solid var(--border);
}
.edges-list {
  display: flex;
  flex-direction: column;
}
.edge {
  padding: 20px 0;
  border-top: 1px solid var(--border);
}
.edge:last-child { border-bottom: 1px solid var(--border); }
.edge dt {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}
.edge dd {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* ======================================================
   Install CTA
   ====================================================== */
.section-install {
  padding: 120px 0;
  border-top: 1px solid var(--border);
}
.section-install h2 {
  font-size: 36px;
  margin-bottom: 12px;
}
.section-install p {
  color: var(--muted);
  margin-bottom: 28px;
}
.install-meta {
  font-size: 13px;
  color: var(--faint);
  margin-top: 16px;
}

/* ======================================================
   Footer
   ====================================================== */
.footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-links {
  display: flex;
  gap: 24px;
}
.footer-links a {
  font-size: 13px;
  color: var(--faint);
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--fg); }
.footer-right {
  font-size: 13px;
  color: var(--faint);
}

/* ======================================================
   Legal pages
   ====================================================== */
.legal-page { padding: 120px 0 80px; }
.legal-page h1 { font-size: clamp(28px, 4vw, 38px); margin-bottom: 8px; }
.legal-updated { font-size: 14px; color: var(--faint); margin-bottom: 48px; }
.legal-page h2 { font-size: 19px; margin-top: 48px; margin-bottom: 12px; }
.legal-page p, .legal-page li { font-size: 15px; color: var(--muted); line-height: 1.8; }
.legal-page ul { padding-left: 24px; margin-bottom: 16px; }
.legal-page li { margin-bottom: 6px; }
.legal-page a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ======================================================
   Responsive
   ====================================================== */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .hero-visual {
    display: flex;
    justify-content: center;
  }
  .overlay-demo { transform: none; }
  .hero-visual:hover .overlay-demo { transform: none; }
  @keyframes overlayEnter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .setup-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .setup-visual {
    order: -1;
    display: flex;
    justify-content: center;
  }

  .privacy-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (max-width: 600px) {
  .nav-links { display: none; }
  .hero { padding: 120px 0 80px; }
  .hero-text h1 { font-size: 30px; }
  .hero-lede { font-size: 16px; }
  .hero-actions { flex-direction: column; align-items: flex-start; gap: 8px; }

  .section-how, .section-setup, .section-privacy, .section-edges, .section-install {
    padding: 80px 0;
  }

  h2 { font-size: 24px; }
  .section-install h2 { font-size: 28px; }

  .calc-table th, .calc-table td { padding: 10px 14px; font-size: 12px; }
  .calc-meta { font-size: 12px; padding: 10px 14px; }

  .overlay-demo, .panel-demo { width: 100%; max-width: 340px; }

  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; gap: 16px; }
}
