/*
  Ack&Relax website.

  Colors come from the app:
    Ack&Relax/Problems/ProblemStyle.swift   Color.paper, Color.calmGreen, Severity.pigment
    Ack&Relax/Forest/ForestPalette.swift    day and night keyframes (sky, ink)
  Text colors reach at least 4.5:1 on paper and on cards in both modes.
*/

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --paper: #f7f2e6;          /* Color.paper, light (0.97, 0.95, 0.90) */
  --card: #fffefb;
  --ink: #2e4540;            /* ForestPalette.day.ink (0.18, 0.27, 0.25) */
  --ink-soft: #5e6e69;       /* secondary text: 4.8:1 on paper */
  --accent: #6b9473;         /* Color.calmGreen (0.42, 0.58, 0.45): icons, rules */
  --link: #4a7353;           /* calmGreen, deepened for text: 4.9:1 on paper */
  --link-hover: #2b5245;     /* ForestPalette.day.nearTrees */
  --sky: #9ec7db;            /* ForestPalette.day.skyTop */
  --hairline: rgb(46 69 64 / 0.13);
  --shadow: 0 1px 2px rgb(46 69 64 / 0.05), 0 10px 30px -12px rgb(46 69 64 / 0.16);
  --code-bg: rgb(46 69 64 / 0.06);
  --chip-bg: rgb(107 148 115 / 0.13);
  --forest: url("forest-day.svg");

  /* Severity.pigment */
  --warning: #d9a84d;        /* yellow ochre  (0.85, 0.66, 0.30) */
  --average: #d1804d;        /* raw sienna    (0.82, 0.50, 0.30) */
  --high: #b3543d;           /* burnt sienna  (0.70, 0.33, 0.24) */
  --disaster: #942b40;       /* madder        (0.58, 0.17, 0.25) */

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 22px;
  --measure: 42rem;
  --wide: 72rem;
  --gutter-l: max(1rem, env(safe-area-inset-left));
  --gutter-r: max(1rem, env(safe-area-inset-right));
  /* Height of the forest painting; at 20vw it always spans the full width (5:1). */
  --forest-h: max(15rem, 20vw);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c212e;        /* Color.paper, dark (0.11, 0.13, 0.18) */
    --card: #252b3a;
    --ink: #f0ebd9;          /* ForestPalette.night.ink (0.94, 0.92, 0.85) */
    --ink-soft: #b3b5ae;
    --accent: #8db495;
    --link: #9cc3a3;
    --link-hover: #c6ddca;
    --sky: #1a2140;          /* ForestPalette.night.skyTop */
    --hairline: rgb(240 235 217 / 0.11);
    --shadow: 0 0 0 1px rgb(240 235 217 / 0.05);
    --code-bg: rgb(240 235 217 / 0.07);
    --chip-bg: rgb(141 180 149 / 0.16);
    --forest: url("forest-night.svg");
  }
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
  /* No smooth scrolling: it can keep links like /setup#troubleshooting
     from jumping to their section when the page loads. */
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper) url("paper.svg");
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
  overflow-wrap: break-word;
}

main { flex: 1; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: clamp(2.1rem, 1.6rem + 2.4vw, 3rem); font-weight: 500; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }

p, ul, ol, dl, pre { margin: 0 0 1em; }
:is(p, ul, ol, dl, pre):last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.3em; }
li + li { margin-top: 0.3em; }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

code, pre { font-family: var(--mono); font-size: 0.9em; }
code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}
pre {
  background: var(--code-bg);
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: 1em; }

strong { font-weight: 600; }

img { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter-l);
  top: 0.75rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--card);
  color: var(--link);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.wrap {
  max-width: calc(var(--measure) + var(--gutter-l) + var(--gutter-r));
  margin-inline: auto;
  padding-inline: var(--gutter-l) var(--gutter-r);
}
.wrap-wide {
  max-width: calc(var(--wide) + var(--gutter-l) + var(--gutter-r));
  margin-inline: auto;
  padding-inline: var(--gutter-l) var(--gutter-r);
}

/* ---------- Header ---------- */

.site-header { background: var(--sky); }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  padding-block: max(0.75rem, env(safe-area-inset-top)) 0.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand img { width: 34px; height: 34px; }

.app-icon {
  display: block;
  border-radius: 22.5%;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 6px 16px -6px rgb(0 0 0 / 0.3);
}

.site-nav ul {
  display: flex;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.55rem;
  border-radius: 999px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { background: rgb(255 255 255 / 0.3); color: var(--ink); }
.site-nav a[aria-current="page"] {
  background: rgb(255 255 255 / 0.45);
  box-shadow: inset 0 0 0 1px rgb(46 69 64 / 0.12);
}

@media (prefers-color-scheme: dark) {
  .site-nav a:hover { background: rgb(240 235 217 / 0.08); }
  .site-nav a[aria-current="page"] {
    background: rgb(240 235 217 / 0.12);
    box-shadow: inset 0 0 0 1px rgb(240 235 217 / 0.12);
  }
}

/* ---------- Forest masthead ---------- */

/*
  The painting sits at the bottom of the intro, fading into the paper.
  Above the painting, a band of solid sky continues the gradient's top color.
  The bottom padding keeps text clear of the trees.
*/
.masthead {
  background:
    var(--forest) center bottom / auto var(--forest-h) no-repeat,
    linear-gradient(var(--sky), var(--sky)) top / 100% calc(100% - var(--forest-h) + 4px) no-repeat;
  padding-top: 1.5rem;
  padding-bottom: calc(var(--forest-h) * 0.62);
}

.masthead h1 { max-width: 20ch; }

.masthead .lede {
  margin-top: 0.6rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  max-width: 34rem;
}

/* Home: a taller painting with the app icon and the tagline. */
.hero {
  --forest-h: max(21rem, 26vw);
  padding-top: clamp(1.5rem, 5vw, 3.5rem);
  padding-bottom: calc(var(--forest-h) * 0.6);
  text-align: center;
}
.hero .app-icon {
  width: clamp(88px, 18vw, 120px);
  height: auto;
  margin: 0 auto 1.25rem;
  border-radius: 22.5%;
}
.hero h1 { margin-inline: auto; font-size: clamp(2.6rem, 2rem + 3vw, 3.75rem); }
.hero .lede { margin-inline: auto; font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem); }
.hero .availability {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.4rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.45);
  box-shadow: inset 0 0 0 1px rgb(46 69 64 / 0.1);
  font-size: 0.95rem;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  .hero .availability {
    background: rgb(240 235 217 / 0.1);
    box-shadow: inset 0 0 0 1px rgb(240 235 217 / 0.12);
  }
}

/* The four pigment dots from the app's problem card. */
.pigments {
  display: inline-flex;
  gap: 0.3rem;
}
.pigments i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--dot) 70%, transparent), var(--dot) 70%);
  box-shadow: inset 0 0 0 1.5px var(--dot);
}
.pigments i:nth-child(1) { --dot: var(--high); }
.pigments i:nth-child(2) { --dot: var(--average); }
.pigments i:nth-child(3) { --dot: var(--warning); }
.pigments i:nth-child(4) { --dot: var(--disaster); }

/* ---------- Content ---------- */

.content { padding-block: 0.5rem 4rem; }

.content > * + * { margin-top: 1.25rem; }
.content > h2 { margin-top: 2.75rem; }
.content > h2 + * { margin-top: 0.9rem; }

.intro { font-size: 1.125rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
}
@media (min-width: 40rem) {
  .card { padding: 1.6rem 1.8rem; }
}

.card > h2, .card > h3 { margin-bottom: 0.7rem; }
.card > h2 { font-size: 1.3rem; }
.card :is(h2, h3) + p { margin-top: 0; }

.section-title {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
}

.note {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* Setup steps */
.step h2 {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.step-number {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--link);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 650;
  transform: translateY(-0.1rem);
}

/* "Users → User roles → Create user role" */
.menu-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  background: var(--chip-bg);
  font-weight: 600;
}
.menu-path .label {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Field: value lists, like the Zabbix forms they describe. */
.fields { margin-top: 1rem; }
.fields dt { font-weight: 600; }
.fields dd { margin: 0.1rem 0 0.85rem; }
.fields dd:last-child { margin-bottom: 0; }
.fields dd ul { margin: 0.35rem 0 0.6rem; }
.fields dd pre { margin-top: 0.6rem; }

/* Troubleshooting and FAQ answers */
.qa dt {
  font-weight: 600;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}
.qa dt:first-child { padding-top: 0; border-top: 0; }
.qa dd { margin: 0.3rem 0 1rem; }
.qa dd:last-child { margin-bottom: 0; }

.faq-item h2 { font-size: 1.2rem; }

/* Rows with chevrons, like Help & Info in the app. */
.rows {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}
.rows li { margin: 0; }
.rows li + li a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.4rem;
  right: 0;
  border-top: 1px solid var(--hairline);
}
.rows a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 0.75rem 3rem 0.75rem 1.4rem;
  color: var(--ink);
  text-decoration: none;
}
.rows a::after {
  content: "";
  position: absolute;
  right: 1.45rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid var(--ink-soft);
  border-right: 2px solid var(--ink-soft);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.6;
}
.rows a:hover { color: var(--ink); background: var(--code-bg); }
.rows li:first-child a { border-radius: var(--radius) var(--radius) 0 0; }
.rows li:last-child a { border-radius: 0 0 var(--radius) var(--radius); }
.rows .row-title { font-weight: 500; color: var(--link); }
.rows .row-detail { display: block; color: var(--ink-soft); font-size: 0.93rem; }
.rows.card { padding: 0; }

/* Primary action, e.g. the support e-mail */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  background: var(--link);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.button:hover { background: var(--link-hover); color: var(--paper); }

.callout {
  border-left: 4px solid var(--warning);
  padding: 0.2rem 0 0.2rem 1rem;
}

address { font-style: normal; }

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

.highlights {
  display: grid;
  gap: 1rem;
  padding: 0;
  list-style: none;
}
@media (min-width: 40rem) {
  .highlights { grid-template-columns: 1fr 1fr; }
}
.highlights li { margin: 0; }
.highlights h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}
.highlights h3::before {
  content: "";
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--dot) 70%, transparent), var(--dot) 70%);
  box-shadow: inset 0 0 0 1.5px var(--dot);
}
.highlights li:nth-child(1) { --dot: var(--accent); }
.highlights li:nth-child(2) { --dot: var(--warning); }
.highlights li:nth-child(3) { --dot: var(--average); }
.highlights li:nth-child(4) { --dot: var(--high); }
.highlights p { color: var(--ink-soft); }

/* Screenshots: a swipeable strip on phones, centered rows of four on wide screens. */
.gallery-section { padding-block: 0.5rem 1rem; }
.gallery-section > h2 { text-align: center; margin-bottom: 1.25rem; }

.gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(68vw, 15.5rem);
  gap: 1.25rem;
  margin: 0;
  padding: 0.5rem var(--gutter-r) 1.25rem var(--gutter-l);
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter-l);
  overscroll-behavior-x: contain;
}
.gallery li { margin: 0; scroll-snap-align: start; }
.gallery figure { margin: 0; }
.gallery img {
  display: block;
  width: 100%;
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--hairline), 0 12px 30px -14px rgb(46 69 64 / 0.4);
}
.gallery figcaption {
  margin-top: 0.75rem;
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.45;
  text-align: center;
}

@media (min-width: 60rem) {
  .gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5rem 1.5rem;
    max-width: calc(var(--wide) + var(--gutter-l) + var(--gutter-r));
    margin-inline: auto;
    overflow: visible;
  }
  .gallery li { flex: 0 0 min(15rem, (100% - 3 * 1.5rem) / 4); }
}

.demo-tip {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}
.demo-tip .pigments { flex: none; margin-top: 0.45rem; }

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

.site-footer {
  padding-block: 2rem max(2rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  color: var(--ink-soft);
  font-size: 0.93rem;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}
.site-footer li { margin: 0; }
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-soft);
}
.site-footer a:hover { color: var(--ink); }
.site-footer p { margin: 0.25rem 0 0; }

/* ---------- Print ---------- */

@media print {
  .site-header, .site-nav, .skip-link, .gallery-section { display: none; }
  .masthead { background: none; padding: 0 0 1rem; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  body { background: #fff; color: #000; }
}
