/*
 * site.css: the one stylesheet for every GrumpTech host, copied into each
 * dist/<host>/ folder by scripts/build.py.
 *
 * Pages carry `theme-<name>` (from site.json: grumptech, eventkit,
 * runshortcuts, flconvert) and `layout-<name>` (from front matter) on
 * <body>. Themes set custom properties and decorative backgrounds, plus a
 * few theme-scoped rules (grumptech.dev's app cards, flconvert's chrome
 * hero and section cards). layout-landing turns the hero and per-H2
 * sections that build.py emits into bands or cards.
 *
 * Plain CSS only: no web fonts, no scripts, so it runs on Fastmail's static
 * hosting unchanged. Every image here is decorative and lives in CSS, so it
 * never reaches the accessibility tree.
 */

:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #5f5f66;
  --rule: #d2d2d7;
  --surface: #f5f5f7;
  --card: #ffffff;
  --code-bg: #f0f0f4;
  --pre-bg: #17132a;
  --pre-fg: #f2f2f7;
  --ink: #17132a;
  --ink-fg: #f4f2fb;
  --ink-muted: #c9c2e3;
  --bolt: #ffd60a;
  --bolt-edge: #4b1fa6;
  --link: #5b2bc4;
  --accent: #5b2bc4;
  --accent-fg: #ffffff;
  --mast-bg: var(--ink);
  --mast-fg: var(--ink-fg);
  --hero-bg: var(--ink);
  --hero-fg: var(--ink-fg);
  --hero-muted: var(--ink-muted);
  --hero-icon: none;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(23 19 42 / 0.08);
  --radius: 18px;
  --avatar: url("/grumptech-avatar.png");
  --bolt-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.5 1.5 4 13.5h6.5L9 22.5l10-13h-6.8z' fill='%23FFD60A' stroke='%234B1FA6' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121016;
    --fg: #f2f2f7;
    --muted: #a8a6b3;
    --rule: #34313f;
    --surface: #1b1922;
    --card: #1e1c26;
    --code-bg: #2a2734;
    --pre-bg: #0b0a10;
    --link: #b9a2ff;
    --accent: #b9a2ff;
    --accent-fg: #17132a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

/* ---------- Themes ---------- */

.theme-eventkit {
  --link: #0058cc;
  --accent: #0058cc;
  --mast-bg: #d70015;
  --mast-fg: #ffffff;
  --hero-bg: linear-gradient(160deg, #ffffff 0%, #e6e8ec 60%, #c9cdd3 100%);
  --hero-fg: #1d1d1f;
  --hero-muted: #45454c;
  --hero-icon: url("/icon.png");
}

@media (prefers-color-scheme: dark) {
  .theme-eventkit {
    --link: #6cb4ff;
    --accent: #6cb4ff;
    --hero-bg: linear-gradient(160deg, #2b2a31 0%, #202025 60%, #151418 100%);
    --hero-fg: #f2f2f7;
    --hero-muted: #c2c2ca;
  }
}

.theme-runshortcuts {
  --link: #8a1fb0;
  --accent: #8a1fb0;
  --brand-gradient: linear-gradient(90deg, #c2185b 0%, #9c1fa0 50%, #5b2bc4 100%);
  --mast-bg: var(--brand-gradient);
  --mast-fg: #ffffff;
  --hero-bg:
    radial-gradient(ellipse at 85% 120%, rgb(255 214 10 / 0.22), transparent 55%),
    var(--brand-gradient);
  --hero-fg: #ffffff;
  --hero-muted: #ffffff;
  --hero-icon: url("/icon.png");
}

@media (prefers-color-scheme: dark) {
  .theme-runshortcuts {
    --link: #e19bff;
    --accent: #e19bff;
  }
}

.theme-flconvert {
  --link: #1f5596;
  --accent: #2b5a8c;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --mast-bg: linear-gradient(90deg, #3a3f47 0%, #23262c 100%);
  --mast-fg: #ffffff;
  --hero-bg:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='48'%3E%3Ctext x='4' y='19' font-family='Menlo,monospace' font-size='12' fill='%23b9bfc8'%3E0 01111111 00000000000000000000000%3C/text%3E%3Ctext x='4' y='41' font-family='Menlo,monospace' font-size='12' fill='%23b9bfc8'%3E0x3F800000 1065353216 1.0 Q7.8%3C/text%3E%3C/svg%3E") 0 0 / 340px 48px,
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.18) 0 1px, transparent 1px 3px),
    linear-gradient(160deg, #fbfbfc 0%, #dde1e6 55%, #b3bac3 100%);
  --hero-fg: #1c1d21;
  --hero-muted: #2f343b;
  --hero-icon: url("/icon.png");
}

@media (prefers-color-scheme: dark) {
  .theme-flconvert {
    --link: #8fb8e6;
    --accent: #8fb8e6;
  }
}

.theme-grumptech {
  --hero-bg:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.09) 1px, transparent 0) 0 0 / 22px 22px,
    radial-gradient(ellipse at 80% 0%, rgb(91 43 196 / 0.55), transparent 60%),
    radial-gradient(ellipse at 0% 100%, rgb(194 24 91 / 0.35), transparent 55%),
    var(--ink);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2.1rem; margin-top: 0; }
h2 { font-size: 1.45rem; margin-top: 2.4rem; }
h3 { font-size: 1.15rem; margin-top: 1.6rem; }
h4 { font-size: 1rem; margin-top: 1.2rem; }

.layout-page h2 { border-bottom: 1px solid var(--rule); padding-bottom: 0.35rem; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, .table-wrap:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--bg); color: var(--link); padding: 0.5rem 1rem; z-index: 10; }
.skip-link:focus { left: 0; }

ul, ol { padding-left: 1.4rem; }
li { margin: 0.3rem 0; }
hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }

code { background: var(--code-bg); border-radius: 5px; padding: 0.12em 0.4em; font-size: 0.88em;
       font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--pre-bg); color: var(--pre-fg); border-radius: 12px; padding: 1rem 1.15rem; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; color: inherit; }

blockquote { margin: 1.2rem 0; padding: 0.2rem 1.1rem; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 10px 10px 0; color: var(--fg); }

.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--rule); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.55rem 0.75rem; text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { background: var(--surface); font-weight: 600; }

.app-version, .updated { color: var(--muted); font-size: 0.9rem; }
.app-version { margin: -0.6rem 0 1.8rem; }

/* ---------- Masthead ---------- */

.masthead { background: var(--mast-bg); color: var(--mast-fg); }

.site-header, .layout-page main, .site-footer {
  max-width: 48rem;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.layout-landing .site-header, .layout-landing .site-footer { max-width: 64rem; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.site-name { margin: 0; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.site-name a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; }
.site-name a::before {
  content: "";
  width: 1.6rem;
  height: 1.6rem;
  background: var(--hero-icon) center / contain no-repeat;
}
.theme-grumptech .site-name a::before { width: 2rem; height: 2rem; background: var(--avatar) center / contain no-repeat; }

nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.masthead nav a { color: inherit; text-decoration: none; font-size: 0.95rem; opacity: 0.92; }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { opacity: 1; text-decoration: underline; text-decoration-thickness: 2px; }
.masthead a:focus-visible { outline-color: currentColor; }

.layout-page main { padding-top: 2rem; padding-bottom: 3rem; }

/* ---------- Store links ---------- */

/* Apple's badge artwork is shown unmodified at its native 40 px height (the
   onscreen minimum) with a quarter of its height (10 px) of clear space. */
.store { margin: 1.25rem 0 0; }
.store-badge { display: inline-block; margin: 10px 0; line-height: 0; border-radius: 8px; }
.store-badge img { display: block; height: 40px; width: auto; }
.store-soon {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1.5px dashed currentColor;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---------- Landing: hero ---------- */

.layout-landing main { padding: 0; }

.hero { background: var(--hero-bg); color: var(--hero-fg); }
.hero-inner {
  position: relative;
  max-width: 64rem;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 4rem;
}
.hero-inner::before {
  content: "";
  display: block;
  width: 7rem;
  height: 7rem;
  margin-bottom: 1.25rem;
  background: var(--hero-icon) center / contain no-repeat;
  filter: drop-shadow(0 10px 24px rgb(0 0 0 / 0.22));
}
.hero h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); margin: 0 0 0.75rem; letter-spacing: -0.03em; }
.hero p { font-size: 1.15rem; max-width: 36rem; color: var(--hero-muted); margin: 0.5rem 0; }
.hero a { color: inherit; }
.hero .store-soon { color: var(--hero-fg); }

@media (min-width: 52rem) {
  .hero-inner { padding-right: 20rem; min-height: 22rem; }
  .hero-inner::before {
    position: absolute;
    right: 2rem;
    top: 50%;
    width: 15rem;
    height: 15rem;
    margin: -7.5rem 0 0;
    transform: rotate(-6deg);
  }
}

.theme-grumptech .hero-inner::before {
  background:
    var(--avatar) center / contain no-repeat,
    radial-gradient(circle at center, rgb(255 255 255 / 0.14), transparent 68%);
  filter: drop-shadow(0 12px 28px rgb(0 0 0 / 0.35));
  transform: none;
}
.theme-grumptech .hero h1 { font-size: clamp(2.8rem, 8vw, 4.6rem); }

.theme-eventkit .hero { border-bottom: 1px solid var(--rule); }

/* ---------- Landing: bands ---------- */

.bands {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 3.5rem;
}
.band { max-width: 46rem; }
.band h2 { font-size: 1.6rem; margin: 2.75rem 0 0.75rem; }
.band h2::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 4px;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: var(--accent);
}

.band[aria-labelledby="how-it-works"] { max-width: none; }
.band[aria-labelledby="how-it-works"] ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}
.band[aria-labelledby="how-it-works"] li {
  margin: 0;
  padding: 1.25rem 1.25rem 1.25rem 3.4rem;
  background: var(--card) var(--bolt-svg) 1.1rem 1.35rem / 1.4rem no-repeat;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--muted);
}
.band[aria-labelledby="how-it-works"] li strong { display: block; color: var(--fg); font-size: 1.05rem; margin-bottom: 0.2rem; }

.band[aria-labelledby="free-and-pro"] {
  max-width: none;
  margin-top: 2.75rem;
  padding: 0.25rem 1.75rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--rule);
}
.band[aria-labelledby="free-and-pro"] h2 { margin-top: 1.5rem; }

/* ---------- grumptech.dev: app cards ---------- */

.theme-grumptech .bands {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
  gap: 1.5rem;
  margin-top: -2.5rem;
  position: relative;
}
.theme-grumptech .band {
  max-width: none;
  display: flex;
  flex-direction: column;
  padding: 0 1.4rem 1.4rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.theme-grumptech .band::before {
  content: "";
  display: block;
  height: 9rem;
  margin: 0 -1.4rem;
  background: var(--card-art, var(--ink));
}
.theme-grumptech .band h2 { margin: 1.25rem 0 0.5rem; font-size: 1.4rem; }

/* Whole-card link: the heading's link stretches over the card; the card's
   own links sit above it so they stay clickable. */
.theme-grumptech .band { position: relative; }
.theme-grumptech .band h2 a { color: inherit; text-decoration: none; }
.theme-grumptech .band h2 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.theme-grumptech .band h2 a:focus-visible { outline: none; }
.theme-grumptech .band h2 a:focus-visible::after { outline: 3px solid var(--accent); outline-offset: 3px; }
.theme-grumptech .band p a, .theme-grumptech .band .store { position: relative; z-index: 1; }
.theme-grumptech .band:has(h2 a):hover { border-color: var(--accent); }
.theme-grumptech .band:has(h2 a):hover h2 a { text-decoration: underline; text-decoration-thickness: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .theme-grumptech .band:has(h2 a) { transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
  .theme-grumptech .band:has(h2 a):hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgb(0 0 0 / 0.08), 0 14px 32px rgb(23 19 42 / 0.16); }
}
.theme-grumptech .band p { margin: 0.4rem 0; }
.theme-grumptech .band .store { margin-top: auto; padding-top: 1rem; }
.theme-grumptech .band .store-soon { font-size: 0.9rem; padding: 0.5rem 1rem; }

.band[aria-labelledby="fl-convert"] {
  --accent: #6b7280;
  --card-art:
    url("/flconvert.png") center / 5.1rem no-repeat,
    radial-gradient(circle at center, #ffffff 0 3.7rem, #a9b0b9 3.7rem 3.85rem, transparent 3.9rem),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='44'%3E%3Ctext x='4' y='18' font-family='Menlo,monospace' font-size='12' fill='%23aab1ba'%3E0 01111111 00000000000000000000000%3C/text%3E%3Ctext x='4' y='38' font-family='Menlo,monospace' font-size='12' fill='%23aab1ba'%3E0x3F800000 1065353216 1.0 Q7.8%3C/text%3E%3C/svg%3E") 0 0 / 300px 44px,
    linear-gradient(160deg, #f4f5f7 0%, #d9dde2 55%, #b5bbc3 100%);
}
.band[aria-labelledby="run-shortcuts-mcp"] {
  --accent: #9c1fa0;
  --card-art:
    url("/runshortcutsmcp.png") center / 7rem no-repeat,
    radial-gradient(ellipse at 85% 120%, rgb(255 214 10 / 0.3), transparent 55%),
    linear-gradient(135deg, #e0467c 0%, #b4239b 50%, #5b2bc4 100%);
}
.band[aria-labelledby="eventkit-mcp"] {
  --accent: #d70015;
  --card-art:
    url("/eventkitmcp.png") center / 7rem no-repeat,
    linear-gradient(#ff3b30 0 1.5rem, transparent 1.5rem),
    linear-gradient(160deg, #ffffff 0%, #e6e8ec 60%, #c9cdd3 100%);
}
.theme-grumptech .band[aria-labelledby="security"] {
  grid-column: 1 / -1;
  display: block;
  padding: 0.25rem 1.4rem 1rem 4.2rem;
  background: var(--surface) var(--avatar) 1.2rem 1.1rem / 2.2rem no-repeat;
  box-shadow: none;
}
.theme-grumptech .band[aria-labelledby="security"]::before { display: none; }
.theme-grumptech .band[aria-labelledby="security"] h2 { font-size: 1.15rem; margin-top: 1.25rem; }
.theme-grumptech .band[aria-labelledby="security"] h2::after { display: none; }

/* ---------- flconvert: chrome hero, bit-register headings ---------- */

.theme-flconvert .site-name a::before { border-radius: 50%; background-color: #ffffff; box-shadow: 0 0 0 1.5px #9aa2ad; }
.theme-flconvert .hero { border-bottom: 1px solid #9aa2ad; }
.theme-flconvert .hero-inner::before {
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 0 0 6px #ffffff, 0 0 0 8px #9aa2ad, 0 14px 30px rgb(0 0 0 / 0.28);
  filter: none;
  transform: none;
}
.theme-flconvert h1, .theme-flconvert h2, .theme-flconvert h3, .theme-flconvert dt { font-family: var(--mono); }
.theme-flconvert .hero h1 { letter-spacing: -0.02em; }
.theme-flconvert .hero-inner > h1, .theme-flconvert .hero-inner > p:not(.store) {
  background: rgb(255 255 255 / 0.85);
  border-radius: 10px;
  padding: 0.15rem 0.7rem;
  width: fit-content;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.08);
}

.theme-flconvert h2 {
  border-bottom: none;
  padding-bottom: 0.75rem;
  background:
    repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 13px) left bottom / 8.1rem 5px no-repeat,
    linear-gradient(var(--rule), var(--rule)) left bottom / 100% 1px no-repeat;
}
.theme-flconvert .band h2::after { display: none; }
.theme-flconvert h3 { font-size: 1.05rem; }
.theme-flconvert li::marker { color: var(--accent); }
.theme-flconvert em { color: var(--muted); }
.theme-flconvert code { border: 1px solid var(--rule); }

.theme-flconvert dl {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) 1fr;
  gap: 0.6rem 1.1rem;
}
.theme-flconvert dt {
  font-weight: 700;
  font-size: 0.92rem;
  align-self: start;
  padding: 0.1rem 0.6rem;
  border-radius: 6px;
  background: var(--code-bg);
  border-left: 3px solid var(--accent);
}
.theme-flconvert dd { margin: 0; }
@media (max-width: 35rem) {
  .theme-flconvert dl { grid-template-columns: 1fr; gap: 0.25rem; }
  .theme-flconvert dd { margin-bottom: 0.5rem; }
}

/* ---------- Footer ---------- */

.footbar { background: var(--ink); color: var(--ink-muted); }
.site-footer { padding-top: 1.75rem; padding-bottom: 2.25rem; font-size: 0.9rem; }
.site-footer a { color: var(--ink-fg); }
.site-footer nav ul { gap: 0.25rem 1.25rem; margin-bottom: 1rem; }
.site-footer p { margin: 0.4rem 0 0; }
.site-footer .brand { display: flex; align-items: center; gap: 0.4rem; }
.site-footer .brand::before {
  content: "";
  width: 1.75rem;
  height: 1.75rem;
  background: var(--avatar) center / contain no-repeat;
}
.site-footer .credits { margin-top: 1rem; font-size: 0.8rem; }
.site-footer a:focus-visible { outline-color: var(--bolt); }
