/* Mario's Pizzeria Kiosk — Shelly Software Co. */
:root {
  --tomato: #d63b2f;
  --tomato-deep: #a82a20;
  --mozz: #fff3c4;
  --basil: #2f9e5b;
  --basil-deep: #1f6f3f;
  --crust: #e5b577;
  --ink: #1b2430;
  --paper: #fbf8f1;

  --bg: var(--paper);
  --bg-2: #f3ecdd;
  --surface: #ffffff;
  --text: #22282f;
  --text-2: #5b6470;
  --line: #e4dccb;
  --accent: var(--tomato);
  --accent-ink: #ffffff;
  --good: var(--basil);
  --shadow: 0 10px 30px rgba(60, 40, 10, .10);
  --radius: 14px;

  --font-display: "Baloo 2", "Trebuchet MS", sans-serif;
  --font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161d27; --bg-2: #1b2430; --surface: #222c3a; --text: #f1ede3; --text-2: #aab3bf;
    --line: #34404f; --accent: #ef5b4e; --shadow: 0 10px 30px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161d27; --bg-2: #1b2430; --surface: #222c3a; --text: #f1ede3; --text-2: #aab3bf;
  --line: #34404f; --accent: #ef5b4e; --shadow: 0 10px 30px rgba(0,0,0,.35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 17px; line-height: 1.6;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 .4em; text-wrap: balance; font-weight: 700; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--accent); }
code, pre, .mono { font-family: var(--font-mono); }
.eyebrow { font-family: var(--font-body); font-weight: 800; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: .6rem; }
.muted { color: var(--text-2); }
.wrap { width: min(1120px, 92vw); margin: 0 auto; }
section { padding: clamp(3rem, 7vw, 6rem) 0; }
section + section { border-top: 1px solid var(--line); }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; white-space: nowrap; flex: 0 0 auto; }
.brand svg, .brand img { width: 34px; height: 34px; flex: 0 0 auto; }
/* nowrap on each link stops labels such as "How it was built" breaking mid-phrase and
   overflowing the fixed-height bar; the gap tightens as the viewport narrows. */
.nav-links { display: flex; gap: clamp(.55rem, 1.3vw, 1.15rem); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.nav-links a { color: var(--text-2); text-decoration: none; white-space: nowrap; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--accent); }
.nav .btn { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 1140px) { .nav-links { display: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .85rem 1.4rem; border-radius: 999px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 0 var(--tomato-deep); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--tomato-deep); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text); }
:focus-visible { outline: 3px solid var(--basil); outline-offset: 3px; }

/* gingham tablecloth hero */
.hero { position: relative; overflow: hidden; padding: clamp(3rem, 7vw, 6rem) 0 0; border-bottom: 1px solid var(--line); }
.gingham {
  position: absolute; inset: 0; z-index: 0; opacity: .55;
  background:
    repeating-linear-gradient(0deg, rgba(214,59,47,.16) 0 22px, transparent 22px 44px),
    repeating-linear-gradient(90deg, rgba(214,59,47,.16) 0 22px, transparent 22px 44px);
  mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
}
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: end; }
.hero-copy { padding-bottom: clamp(2rem, 5vw, 4rem); }
.hero-copy h1 span { color: var(--accent); display: block; }
.hero-copy p { font-size: 1.2rem; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.4rem; }
.hero-shelly { display: flex; justify-content: center; align-items: flex-end; }
.hero-shelly svg { width: min(100%, 420px); height: auto; }
@media (max-width: 820px) { .hero .wrap { grid-template-columns: 1fr; } .hero-shelly { order: -1; } .hero-shelly svg { width: 260px; } }

/* stats strip */
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.strip div { background: var(--surface); padding: 1.1rem 1.2rem; }
.strip b { display: block; font-family: var(--font-display); font-size: 1.7rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.strip span { font-size: .85rem; color: var(--text-2); font-weight: 700; }
@media (max-width: 720px) { .strip { grid-template-columns: 1fr 1fr; } }

/* receipt */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }
.receipt {
  background: #fffdf7; color: #222; font-family: var(--font-mono); font-size: .86rem; line-height: 1.5;
  padding: 1.6rem 1.4rem 2.4rem; box-shadow: var(--shadow); position: relative; max-width: 420px; margin: 0 auto;
  --zig: 10px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--zig)), 95% 100%, 90% calc(100% - var(--zig)), 85% 100%, 80% calc(100% - var(--zig)), 75% 100%, 70% calc(100% - var(--zig)), 65% 100%, 60% calc(100% - var(--zig)), 55% 100%, 50% calc(100% - var(--zig)), 45% 100%, 40% calc(100% - var(--zig)), 35% 100%, 30% calc(100% - var(--zig)), 25% 100%, 20% calc(100% - var(--zig)), 15% 100%, 10% calc(100% - var(--zig)), 5% 100%, 0 calc(100% - var(--zig)));
}
.receipt pre { margin: 0; white-space: pre-wrap; }
.receipt .ans { color: var(--tomato-deep); font-weight: 700; }
.receipt .total { font-weight: 700; font-size: 1rem; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; counter-reset: step; }
.timeline li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; position: relative; }
.timeline li::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--basil); color: #fff; font-family: var(--font-display); font-weight: 800; margin-bottom: .6rem; }
.timeline h3 { font-size: 1.05rem; }
.timeline p { font-size: .92rem; color: var(--text-2); margin: 0; }
@media (max-width: 1000px) { .timeline { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .timeline { grid-template-columns: 1fr 1fr; } }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: .75rem .9rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--ink); color: #fff; font-weight: 800; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
td.c, th.c { text-align: center; }
.raci td.c { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.R { background: #d5f5e3; color: #1f6f3f; } .A { background: #fadbd8; color: #a82a20; } .C { background: #fdebd0; color: #8a5a10; } .I { background: #eaf2f8; color: #3b5b7a; }
.AR { background: linear-gradient(135deg, #fadbd8 50%, #d5f5e3 50%); color: #1b2430; }
.legend { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; font-size: .9rem; margin: 1rem 0 0; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: .4rem; vertical-align: -2px; }
.legend .lr::before { background: #d5f5e3; } .legend .la::before { background: #fadbd8; } .legend .lc::before { background: #fdebd0; } .legend .li::before { background: #eaf2f8; }
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 800; letter-spacing: .04em; }
.must { background: #fadbd8; color: #a82a20; } .should { background: #fdebd0; color: #8a5a10; } .could { background: #eaf2f8; color: #3b5b7a; } .opt { background: #d5f5e3; color: #1f6f3f; } .quality { background: #ece7f5; color: #574080; }
.mono-cell { font-family: var(--font-mono); font-size: .85rem; white-space: nowrap; }

/* code viewer */
.code-tabs { display: flex; gap: .4rem; margin-bottom: -1px; }
.code-tabs button { background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; padding: .6rem 1rem; font: 700 .9rem var(--font-mono); color: var(--text-2); cursor: pointer; }
.code-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.code-panel { border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius); overflow: hidden; background: var(--ink); }
.code-panel pre { margin: 0; padding: 1.2rem; overflow-x: auto; font-size: .82rem; line-height: 1.55; max-height: 560px; color: #e8e6e3; }
.code-panel[hidden] { display: none; }
.hljs-keyword { color: #ff8a80; } .hljs-string { color: #ffe082; } .hljs-comment { color: #8fa3b8; font-style: italic; } .hljs-number { color: #a5d6a7; } .hljs-built_in, .hljs-title { color: #80d8ff; } .hljs-params { color: #e8e6e3; }

/* downloads */
.downloads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.dl { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: transform .12s ease, box-shadow .12s ease; }
.dl:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.dl .ext { font: 800 .72rem var(--font-mono); letter-spacing: .08em; background: var(--ink); color: #fff; padding: .55rem .5rem; border-radius: 8px; min-width: 52px; text-align: center; }
.dl b { display: block; font-family: var(--font-display); }
.dl small { color: var(--text-2); }
@media (max-width: 820px) { .downloads { grid-template-columns: 1fr; } }

/* callout */
.callout { border-left: 5px solid var(--basil); background: var(--surface); padding: 1rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0; }

footer { padding: 2.5rem 0 3rem; border-top: 1px solid var(--line); color: var(--text-2); font-size: .9rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }

/* Shelly bob */
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-8px); } }
@keyframes wiggle { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.bob { animation: bob 2.4s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .bob, .wiggle { animation: none !important; } html { scroll-behavior: auto; } }
