/*
  Loggia website. Follows the app's design language (docs/design.md in yangflow/stoa):
  system fonts only, near-monochrome, and the brand green belongs to the lamp alone.
  The lamp and link-chain styles are ported from the app's design/mockup.html.
*/
:root {
  --paper: #f7f8f7; --surface: #fff; --ink: #17201d; --ink-2: #55615c; --ink-3: #6b7671;
  --rule: rgba(23, 32, 29, .12); --wash: rgba(23, 32, 29, .05);
  --lamp-on: #0fa47a; --lamp-warn: #e8890c; --lamp-error: #e5484d; --lamp-off: #a3aca8;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1211; --surface: #161b19; --ink: #e9eeec; --ink-2: #a3afaa; --ink-3: #8a9690;
    --rule: rgba(233, 238, 236, .12); --wash: rgba(233, 238, 236, .05);
    --lamp-on: #34d399; --lamp-warn: #f5a524; --lamp-error: #f2555a; --lamp-off: #5d6863;
  }
}
@media (prefers-contrast: more) {
  :root { --lamp-on: #0a8a66; }
  @media (prefers-color-scheme: dark) { :root { --lamp-on: #5eeab0; } }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font: 17px/1.6 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
code { font: .88em var(--mono); background: var(--wash); padding: .1em .35em; border-radius: 5px; }
h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 650; text-wrap: balance; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 8px 14px; border-radius: var(--radius); background: var(--ink); color: var(--paper); text-decoration: none; }
.skip:focus { top: 12px; }
:lang(en) h1, :lang(en) h2 { letter-spacing: -.022em; }
p { margin: 0; }

.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }
.narrow { width: min(720px, 100% - 48px); }

/* Header & footer */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; text-decoration: none; margin-right: auto; }
.brand img { width: 28px; height: 28px; }
.site-header nav { display: flex; align-items: center; gap: 24px; font-size: 15px; }
.site-header nav a { text-decoration: none; color: var(--ink-2); }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); }
.site-footer { border-top: 1px solid var(--rule); margin-top: 120px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-block: 28px 44px; font-size: 14px; color: var(--ink-3); }
.site-footer span { margin-right: auto; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* Button: ink, not brand green (the green is the lamp's) */
.button { display: inline-flex; align-items: center; height: 44px; padding: 0 22px; border-radius: var(--radius); background: var(--ink); color: var(--paper); font-weight: 600; text-decoration: none; white-space: nowrap; transition: transform .1s; }
.button:hover { background: color-mix(in srgb, var(--ink) 88%, var(--paper)); }
.button:active { transform: translateY(1px); }
.button.disabled { opacity: .4; cursor: not-allowed; }
.button.disabled:hover { background: var(--ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Lamp: the one symbol (shapes from the app; shape alone tells the state) */
.lamp { --sz: 10px; --c: var(--lamp-off); position: relative; flex: none; display: inline-block; width: var(--sz); height: var(--sz); border-radius: 50%; vertical-align: middle; }
.lamp.on { --c: var(--lamp-on); background: var(--c); box-shadow: 0 0 calc(var(--sz) * .8) color-mix(in srgb, var(--c) 45%, transparent); }
.lamp.warn { --c: var(--lamp-warn); border: max(1.5px, calc(var(--sz) * .16)) solid var(--c); background: linear-gradient(90deg, var(--c) 50%, transparent 50%); }
.lamp.error { --c: var(--lamp-error); border: max(1.5px, calc(var(--sz) * .16)) solid var(--c); }
.lamp.error::before, .lamp.error::after { content: ""; position: absolute; left: 50%; top: 50%; width: 55%; height: max(1.2px, calc(var(--sz) * .14)); background: var(--c); border-radius: 2px; transform: translate(-50%, -50%) rotate(45deg); }
.lamp.error::after { transform: translate(-50%, -50%) rotate(-45deg); }
.lamp.off { border: max(1.5px, calc(var(--sz) * .16)) solid var(--lamp-off); }
.lamp.breathe::after { content: ""; position: absolute; inset: -90%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 55%, transparent), transparent 65%); opacity: .35; animation: breathe 3.2s ease-in-out 1.5 forwards; }
@keyframes breathe { 50% { opacity: 1; } }

/* Link chain: This Mac, cloudflared, Cloudflare, Public */
.chain { isolation: isolate; display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr auto; align-items: start; --n: 64px; }
.node { display: grid; justify-items: center; gap: 4px; text-align: center; width: calc(var(--n) * 2.3); margin-inline: calc(var(--n) * -.65); }
.node .ring { width: var(--n); height: var(--n); border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); background: linear-gradient(var(--wash), var(--wash)), var(--paper); margin-bottom: 10px; }
.node .ring svg { width: 46%; height: 46%; }
.node b { font-weight: 600; font-size: 15px; }
.node small { font: 13px/1.4 var(--font); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.node.on .ring { --t: color-mix(in srgb, var(--lamp-on) 13%, transparent); color: var(--lamp-on); background: linear-gradient(var(--t), var(--t)), var(--paper); }
.node.error .ring { --t: color-mix(in srgb, var(--lamp-error) 12%, transparent); color: var(--lamp-error); background: linear-gradient(var(--t), var(--t)), var(--paper); box-shadow: 0 0 0 2px var(--lamp-error); }
.wire { height: 2px; margin-top: calc(var(--n) / 2 - 1px); border-radius: 1px; background: var(--rule); position: relative; overflow: hidden; z-index: -1; }
.wire.lit { background: color-mix(in srgb, var(--lamp-on) 70%, transparent); }
.wire.lit::after { content: ""; position: absolute; inset-block: 0; left: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent); transform: translateX(-100%); animation: flow 2.4s ease-in-out 2; }
.wire.broken { background: repeating-linear-gradient(90deg, var(--lamp-error) 0 4px, transparent 4px 8px); opacity: .75; }
@keyframes flow { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(250%); } }
@media (prefers-color-scheme: dark) { .wire.lit::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); } }

/* Home: hero */
.hero { padding-block: 88px 72px; }
.hero h1 { font-size: clamp(40px, 5.4vw, 64px); max-width: 15em; }
:lang(zh) .hero h1 { max-width: none; }
.hero h1 span, .hero .lead span { display: inline-block; }
:lang(zh) h1, :lang(zh) .lead { hanging-punctuation: allow-end; }
p { text-wrap: pretty; }
.hero .lead { font-size: clamp(18px, 2vw, 21px); color: var(--ink-2); max-width: 34em; margin-top: 20px; }
.hero .button { margin-top: 32px; }
.hero .state { display: flex; align-items: center; gap: 10px; margin-top: 88px; font-weight: 600; font-size: 19px; }
.hero .state .lamp { --sz: 12px; }
.hero .chain { margin-top: 28px; padding-inline: calc(var(--n) * .65); }

/* Home: screenshot */
.shot { margin-block: 0; }
.shot picture, .shot img { display: block; width: 100%; height: auto; }
.shot img { max-width: 1120px; margin-inline: auto; }

/* Home: sections */
.section { padding-top: 128px; }
.section h2 { font-size: clamp(28px, 3.4vw, 40px); max-width: 18em; }
.section .lead { font-size: 19px; color: var(--ink-2); max-width: 36em; margin-top: 16px; }

.lamps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px; margin-top: 56px; }
.lamps .lamp { --sz: 22px; margin-bottom: 20px; }
.lamps h3 { font-size: 19px; }
.lamps p { color: var(--ink-2); margin-top: 6px; font-size: 16px; }

.diagnose { display: grid; grid-template-columns: 5fr 7fr; gap: 64px; align-items: center; }
.diagnose .chain { --n: 48px; padding-inline: calc(var(--n) * .65); }
.diagnose .node b { font-size: 14px; }
.diagnose .message { margin-top: 36px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); display: flex; gap: 12px; }
.diagnose .message .lamp { margin-top: 7px; }
.diagnose .message b { display: block; font-weight: 600; }
.diagnose .message span { color: var(--ink-2); font-size: 15px; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px 64px; margin-top: 48px; max-width: 920px; }
.facts div { border-top: 1px solid var(--rule); padding-top: 20px; }
.facts h3 { font-size: 18px; }
.facts p { color: var(--ink-2); margin-top: 6px; font-size: 16px; }

.steps { list-style: none; padding: 0; margin: 48px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: block; font-size: 44px; font-weight: 300; line-height: 1; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-bottom: 18px; }
.steps h3 { font-size: 18px; }
.steps p { color: var(--ink-2); margin-top: 6px; font-size: 16px; }
.get { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--rule); }
.get p { color: var(--ink-2); font-size: 15px; }

/* Home: download and buy */
.download .status { margin-top: 20px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.button.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.button.secondary:hover { background: var(--wash); }
.button.secondary.disabled:hover { background: transparent; }
.note { margin-top: 12px; font-size: 14px; color: var(--ink-3); }
.plans-wrap { margin-top: 64px; max-width: 760px; }
.plans { width: 100%; border-collapse: collapse; font-size: 16px; }
.plans th, .plans td { padding: 14px 0; text-align: left; border-bottom: 1px solid var(--rule); }
.plans thead th { font-size: 17px; font-weight: 650; padding-top: 0; }
.plans tbody th { font-weight: 400; color: var(--ink-2); padding-right: 24px; }
.plans td { width: 24%; font-variant-numeric: tabular-nums; }
.terms { margin-top: 16px; font-size: 15px; color: var(--ink-2); }

/* Inner pages */
.page { padding-top: 72px; }
.page h1 { font-size: clamp(32px, 4.4vw, 44px); }
.page .lead { font-size: 19px; color: var(--ink-2); margin-top: 14px; }
.page h2 { font-size: 22px; margin-top: 48px; }
.page h2 + p, .page h2 + ul, .page h2 + ol { margin-top: 10px; }
.page p + p { margin-top: 12px; }
.page ul, .page ol { padding-left: 1.3em; }
.page li + li { margin-top: 6px; }
.page pre { white-space: pre-wrap; margin: 32px 0 0; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); font: 14px/1.7 var(--mono); overflow-x: auto; }

/* Download */
.checksum { margin-top: 20px; font-size: 14px; color: var(--ink-3); }
.checksum span { font: 13px/1.5 var(--mono); color: var(--ink-2); word-break: break-all; }
.install { margin-top: 48px; max-width: 760px; color: var(--ink-2); }

/* FAQ: a plain list of disclosures */
.qa { border-bottom: 1px solid var(--rule); }
.page h2 + .qa { margin-top: 8px; }
.qa summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 24px; padding-block: 16px; font-weight: 600; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: ""; flex: none; width: 8px; height: 8px; margin: .5em 4px 0 0; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); transition: transform .2s; }
.qa[open] summary::after { transform: rotate(-135deg); margin-top: .75em; }
.qa > div { padding-bottom: 20px; color: var(--ink-2); }
.qa > div > * + * { margin-top: 10px; }
.qa table { border-collapse: collapse; width: 100%; font-size: 15px; }
.qa td { padding: 8px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.qa td:first-child { color: var(--ink); padding-right: 16px; }
.qa b { color: var(--ink); font-weight: 600; }

/* Changelog */
.page h1 + .release { margin-top: 8px; }
.release { padding-block: 32px; border-bottom: 1px solid var(--rule); }
.release:last-of-type { border-bottom: 0; }
.release-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.release-head h2 { margin: 0; font-size: 24px; font-variant-numeric: tabular-nums; }
.release-head span { font-weight: 600; color: var(--ink-2); }
.release-head time { margin-left: auto; color: var(--ink-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.release > p { color: var(--ink-2); margin-top: 12px; }
.release ul { margin: 12px 0 0; padding-left: 1.3em; }
.release li + li { margin-top: 6px; }

@media (max-width: 860px) {
  .site-header nav { gap: 18px; }
  .site-header nav .secondary { display: none; }
  .hero { padding-block: 56px 48px; }
  .hero .state { margin-top: 56px; }
  .hero .chain, .diagnose .chain { --n: 44px; }
  .node small { font-size: 12px; }
  .node b { font-size: 13px; }
  .section { padding-top: 88px; }
  .lamps { grid-template-columns: repeat(2, 1fr); gap: 32px 24px; }
  .diagnose { grid-template-columns: 1fr; gap: 40px; }
  .facts, .steps { grid-template-columns: 1fr; gap: 28px; }
  .site-footer { margin-top: 88px; }
}
@media (max-width: 480px) {
  .node small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lamp.breathe::after, .wire.lit::after { animation: none; }
  .button, .qa summary::after { transition: none; }
}
