/* ==========================================================================
   Zenscape Apps — shared stylesheet for every page on apps.zenscape.se
   --------------------------------------------------------------------------
   CSS custom properties ("variables", written --name) are defined once on
   :root and reused everywhere, so changing a colour here changes the whole
   site. Each app page sets its own --accent (see .theme-zenhour etc.).
   ========================================================================== */

:root {
  --bg: #0b0e14;          /* page background: near-black with a hint of blue */
  --bg-raised: #11151d;   /* terminal windows and cards */
  --bg-bar: #171c26;      /* terminal title bars */
  --line: #232a36;        /* thin borders */
  --text: #d7dce4;        /* body text */
  --muted: #8a93a3;       /* secondary text */
  --prompt: #7ee787;      /* the green "$" prompt colour */
  --accent: #7ee787;      /* overridden per app below */
  --zenhour: #f4a940;     /* amber, matches Zenhour's golden-hour theme */
  --surfer: #40c7c7;      /* teal, matches Surfer's ocean theme */

  /* System monospace fonts: no web-font download, so no requests to
     third parties (and nothing to mention in a cookie/privacy notice). */
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

  color-scheme: dark;     /* tells the browser to draw dark scrollbars, form controls etc. */
}

.theme-zenhour { --accent: var(--zenhour); }
.theme-surfer  { --accent: var(--surfer); }

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
  /* A very faint grid in the background for the "code editor" feel. */
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 32px 32px;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 720px; }

/* ---------- Header and navigation ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(11,14,20,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 60px; flex-wrap: wrap;
}
.logo {
  font: 600 1rem var(--mono);
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.logo .tilde { color: var(--prompt); }
.logo .path { color: var(--muted); }
.site-nav { display: flex; gap: 20px; font: .9rem var(--mono); }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }

/* ---------- Typography ---------- */

h1, h2, h3 { font-family: var(--mono); line-height: 1.25; color: #fff; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 12px; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; margin: 56px 0 16px; }
/* "## " before section headings, like Markdown source. */
h2::before { content: "## "; color: var(--accent); opacity: .7; }
h3 { font-size: 1rem; margin: 28px 0 6px; }
p, li { margin: 0 0 12px; }
ul, ol { padding-left: 22px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 40em; }
.muted { color: var(--muted); }
code, kbd { font-family: var(--mono); font-size: .9em; }
.comment { font-family: var(--mono); color: var(--muted); font-size: .9rem; }

main { padding: 56px 0 72px; }

/* ---------- Terminal window ---------- */

.terminal {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.7);
  font: .95rem/1.7 var(--mono);
}
.terminal-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--line);
}
/* The three macOS "traffic light" dots. */
.terminal-bar .dot { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.terminal-bar .dot:nth-child(2) { background: #febc2e; }
.terminal-bar .dot:nth-child(3) { background: #28c840; }
.terminal-bar .title {
  flex: 1; text-align: center; color: var(--muted); font-size: .8rem;
  margin-right: 52px; /* balances the dots so the title is truly centred */
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.terminal-body { padding: 18px 20px 20px; overflow-x: auto; }
.terminal-body p { margin: 0; white-space: pre-wrap; }
.terminal .prompt { color: var(--prompt); }
.terminal .prompt .dir { color: #79c0ff; }
.terminal .cmd { color: #fff; }
.terminal .out { color: var(--text); }
.terminal .out.dim { color: var(--muted); }
.terminal .ok { color: var(--accent); }
.terminal .hl { color: var(--accent); }
.terminal .gap { height: .6em; }

/* On phones, drop "zenscape" from the prompt so commands fit on one line. */
@media (max-width: 520px) {
  .terminal .prompt .host { display: none; }
}

/* Lines waiting to be "typed" by terminal.js stay in the layout but are
   invisible, so the page doesn't jump while the animation runs. */
.terminal .pending { visibility: hidden; }

/* The blinking block cursor. steps(1) makes it switch on/off instead of fading. */
.cursor {
  display: inline-block;
  width: .6em; height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* While typing, the cursor stays solid (as in a real terminal). */
.typing .cursor { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

/* ---------- Home page ---------- */

.hero { padding: 24px 0 8px; }
.hero h1 .accent { color: var(--prompt); }
.hero .terminal { margin-top: 32px; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 24px;
}
.app-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  transition: transform .2s ease, border-color .2s ease;
}
.app-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.app-card .terminal-body { flex: 1; }
.app-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.app-card-head img { width: 56px; height: 56px; border-radius: 13px; }
.app-card-head .name { font-size: 1.15rem; color: #fff; font-weight: 600; text-decoration: none; }
.app-card-head .name:hover { color: var(--accent); }
.app-card-head .tag { color: var(--muted); font-size: .8rem; }
.app-card .links {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--line);
  font: .85rem var(--mono); color: var(--accent);
}

.about { display: grid; gap: 8px; }

/* ---------- App page ---------- */

.app-hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.app-hero img {
  width: 112px; height: 112px; border-radius: 25px;
  box-shadow: 0 12px 40px -12px var(--accent);
}
.app-hero .text { flex: 1; min-width: 260px; }
.badge {
  display: inline-block;
  font: .8rem var(--mono);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 12px;
}
.app-page .terminal { margin-top: 40px; }

.link-list {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  padding: 0; list-style: none;
}
.link-list a {
  display: block; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-raised);
  text-decoration: none; color: var(--text);
  font-family: var(--mono);
}
.link-list a:hover { border-color: var(--accent); }
.link-list .arrow { color: var(--accent); }
.link-list small { display: block; color: var(--muted); font-family: var(--sans); margin-top: 4px; }

/* ---------- Document pages (support, privacy) ---------- */

.breadcrumb { font: .85rem var(--mono); color: var(--muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--line); padding: 0 4px; }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--bg-raised);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  margin: 24px 0;
}
.callout p:last-child { margin-bottom: 0; }
.doc h2 { margin-top: 44px; }

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

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font: .85rem var(--mono);
  color: var(--muted);
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
