/* PlanWalk — app shell styles. Mobile first, logical properties only (RTL needs no overrides).
   Palette: white and grey surfaces, near-black ink, one red accent. Contrast pairs are checked by tests/landing-static.test.js. */

:root {
  color-scheme: light dark;
  --paper: #f4f5f7;
  --paper-alt: #eceef1;
  --raised: #ffffff;
  --ink: #1d1f23;
  --muted: #565c68;
  --accent: #c62828;              /* the red: text, rules, rings */
  --accent-fill: #c62828;         /* primary button: resting colour */
  --accent-top: #d63636;          /* top of the gradient */
  --accent-deep: #a92020;         /* hover and pressed */
  --on-accent: #ffffff;
  --control: #6b7280;
  --focus: #c62828;
  --shadow: #1d1f23;
  --line: rgb(29 31 35 / 0.14);
  --grid: rgb(29 31 35 / 0.05);
  --sheet: #ffffff;
  --room-a: #edeff2;
  --room-b: #e3e6ea;
  --hatch: rgb(29 31 35 / 0.28);
  --wall-side: #d9dde3;
  --wall-edge: rgb(29 31 35 / 0.32);
  --wall-cap: #1d1f23;
  --btn-top: #ffffff;             /* secondary button: white to light grey */
  --btn-bottom: #f3f4f6;
  --btn-edge: rgb(29 31 35 / 0.26);
  --btn-lift: 0 1px 2px rgb(29 31 35 / 0.12);
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121417;
    --paper-alt: #181b1f;
    --raised: #1e2126;
    --ink: #eceef1;
    --muted: #a2a8b3;
    --accent: #ff6b6b;
    --accent-fill: #d23232;
    --accent-top: #d93838;
    --accent-deep: #b92a2a;
    --on-accent: #ffffff;
    --control: #8b919b;
    --focus: #ff6b6b;
    --shadow: #000000;
    --line: rgb(236 238 241 / 0.14);
    --grid: rgb(236 238 241 / 0.05);
    --sheet: #1a1d21;
    --room-a: #23272d;
    --room-b: #1f2328;
    --hatch: rgb(236 238 241 / 0.22);
    --wall-side: #2b3037;
    --wall-edge: rgb(236 238 241 / 0.26);
    --wall-cap: #eceef1;
    --btn-top: #2d3138;
    --btn-bottom: #24272d;
    --btn-edge: rgb(236 238 241 / 0.22);
    --btn-lift: 0 1px 2px rgb(0 0 0 / 0.5);
  }
}

/* Script-specific system fonts (all local, nothing is downloaded). */
html:lang(ar) { --font: "Segoe UI", Tahoma, "Geeza Pro", "Noto Sans Arabic", system-ui, sans-serif; --mono: var(--font); }
html:lang(ja) { --font: system-ui, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, "Noto Sans JP", sans-serif; --mono: var(--font); }
html:lang(zh) { --font: system-ui, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif; --mono: var(--font); }

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-wrap: balance;
}

p { margin: 0; }
svg { max-inline-size: 100%; }
a { color: inherit; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }

:lang(ja), :lang(zh) { line-break: strict; }
:lang(ja) h1, :lang(zh) h1, :lang(ja) h2, :lang(zh) h2 { line-height: 1.3; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: 0.75rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  padding-inline: 1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 650;
  border-radius: var(--radius);
  transform: translateY(-300%);
}
.skip-link:focus { transform: none; }
.skip-link:hover { color: var(--paper); }

.wrap {
  inline-size: 100%;
  max-inline-size: 74rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.icon {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-solid { fill: currentColor; stroke: none; }

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

.site-header { border-block-end: 1px solid var(--line); background: var(--raised); box-shadow: 0 1px 8px -4px var(--shadow); }

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  min-block-size: 4rem;
  padding-block: 0.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-block-size: 44px;
  margin-inline-end: auto;
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark:hover { color: inherit; }
.wordmark-mark {
  inline-size: 1.75rem;
  block-size: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
}
.wordmark-mark circle { fill: var(--accent); stroke: none; }

.lang-switch { position: relative; display: flex; align-items: center; gap: 0.4rem; min-inline-size: 0; }
.lang-switch > .icon { position: absolute; inset-inline-start: 0.8rem; inline-size: 1.05rem; block-size: 1.05rem; pointer-events: none; }
.lang-switch select { padding-inline: 1rem 0.5rem; border-radius: 999px; background-image: linear-gradient(var(--btn-top), var(--btn-bottom)); font-weight: 600; }
.lang-switch > .icon ~ select { padding-inline-start: 2.4rem; }

select {
  min-block-size: 44px;
  max-inline-size: 100%;
  padding-block: 0.35rem;
  padding-inline: 0.6rem 0.35rem;
  border: 1.5px solid var(--control);
  border-radius: var(--radius);
  background-color: var(--raised);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

/* "Upload your plan" at the top */
.header-bar .header-cta { display: inline-flex; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-block-size: 3rem;
  padding-block: 0.6rem;
  padding-inline: 1.3rem;
  border: 1px solid var(--btn-edge);
  border-radius: var(--radius);
  background: linear-gradient(var(--btn-top), var(--btn-bottom));
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), var(--btn-lift);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn-primary {
  border-color: var(--accent-deep);
  background: linear-gradient(var(--accent-top), var(--accent-fill));
  color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.28), 0 1px 2px rgb(120 16 16 / 0.35), 0 6px 14px -8px rgb(198 40 40 / 0.6);
}
.btn-primary:hover {
  background: linear-gradient(var(--accent-fill), var(--accent-deep));
  color: var(--on-accent);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.25); }
.btn-secondary:hover { background: linear-gradient(var(--btn-bottom), var(--btn-bottom)); border-color: var(--control); color: var(--ink); transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.15); }
.btn-compact { min-block-size: 44px; padding-inline: 1rem; }

/* ---------- Hero ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 650;
  letter-spacing: 0.1em;
}
.eyebrow { margin-block-end: 1rem; font-size: 0.8rem; text-transform: uppercase; }
.eyebrow::before { content: ""; flex: none; inline-size: 2rem; border-block-start: 2px solid currentColor; }
:lang(ar) .eyebrow, :lang(ja) .eyebrow, :lang(zh) .eyebrow { letter-spacing: 0; }

h1 {
  font-size: clamp(2rem, 1.25rem + 3.4vw, 3.6rem);
  font-weight: 780;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
:lang(ar) h1, :lang(ar) h2 { letter-spacing: 0; line-height: 1.3; }

.lede {
  max-inline-size: 36rem;
  margin-block-start: 1.25rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 2rem; }
@media (max-width: 30em) {
  .actions .btn { flex: 1 1 100%; }
}

.ink-door { fill: none; stroke: var(--ink); stroke-width: 1.2; }

@keyframes pw-rise-in { from { opacity: 0; transform: translateY(1.5rem); } }

/* ---------- Sections ---------- */

h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.5rem);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-block: 1rem 1.25rem;
  padding-inline: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card { box-shadow: 0 1px 2px rgb(29 31 35 / 0.06), 0 6px 18px -12px rgb(29 31 35 / 0.25); }
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgb(29 31 35 / 0.35); }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }

.card-title { margin-block-start: 0.25rem; font-size: 1.2rem; }
.card-link { text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; }
.card-link:focus-visible { outline: none; }
.card-text { color: var(--muted); }
.card-cta {
  margin-block-start: auto;
  padding-block-start: 0.75rem;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 650;
}
.card:hover .card-cta { text-decoration: underline; text-underline-offset: 0.18em; }

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.step {
  position: relative;
  padding-block-start: 3.75rem;
  border-block-start: 2px solid var(--ink);
  counter-increment: step;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  inset-block-start: 1rem;
  inset-inline-start: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}
.step h3 { margin-block-end: 0.5rem; font-size: 1.2rem; }
.step p { color: var(--muted); }

/* FAQ */
.faq { border-block-start: 1px solid var(--line); }
.faq details { border-block-end: 1px solid var(--line); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-block-size: 3.5rem;
  padding-block: 0.75rem;
  font-size: 1.1rem;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  inline-size: 1.1rem;
  block-size: 1.1rem;
  color: var(--accent);
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
}
.faq details[open] summary::after {
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}
.faq summary:hover { color: var(--accent); }
.faq details p { max-inline-size: 44rem; padding-block-end: 1.25rem; color: var(--muted); }

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

.site-footer { padding-block: 2.5rem 2rem; border-block-start: 1px solid var(--line); font-size: 0.95rem; }
.footer-grid { display: grid; gap: 1.5rem; }
.footer-grid > * { min-inline-size: 0; }
@media (min-width: 48em) {
  .footer-grid { grid-template-columns: 1fr auto; align-items: start; }
  .footer-meta { grid-column: 1 / -1; }
}
.footer-brand p { margin-block-start: 0.25rem; color: var(--muted); }
.lang-switch-footer { flex-wrap: wrap; gap: 0.6rem; }
.lang-switch-footer label { font-weight: 650; }
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block-start: 1.25rem;
  border-block-start: 1px dashed var(--line);
  color: var(--muted);
}
.site-footer > .footer-meta { padding-block-start: 0; border-block-start: 0; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.25rem; }
.footer-links a { display: inline-flex; align-items: center; min-block-size: 44px; color: var(--ink); }
.footer-links a:hover { color: var(--accent); }

/* ---------- 404 ---------- */

.notfound { padding-block: clamp(3rem, 10vw, 7rem); }
.notfound-inner { display: grid; gap: 1.25rem; justify-items: start; max-inline-size: 40rem; }
.notfound-art { inline-size: 9rem; block-size: auto; color: var(--ink); }
.notfound-art .ink-door { stroke: var(--accent); stroke-width: 2; }
.notfound-art .wall-line { fill: none; stroke: currentColor; stroke-width: 6; stroke-linecap: square; }
.notfound-text { color: var(--muted); font-size: 1.125rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .card:hover, .btn-primary:hover, .btn-primary:active { transform: none; }
}

@media (forced-colors: active) {
  .btn, .card { border-color: CanvasText; }
  .wall.cap { fill: CanvasText; }
}

/* expired shared link (?expired=1): a note above the header */
.expired-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px;
  padding: 12px 16px; border-block-end: 1px solid rgb(176 112 0 / 0.35); background: #fff4e5; color: #4d3300; text-align: center;
}
.expired-banner[hidden] { display: none; }
.expired-text { margin: 0; max-inline-size: 64ch; }
.expired-cta { white-space: nowrap; }
.expired-close {
  min-inline-size: 44px; min-block-size: 44px; border: 0; background: none; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.expired-close:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .expired-banner { border-color: rgb(255 196 92 / 0.3); background: #2e2410; color: #ffe2b0; }
}

/* Articles and Knowledge base in the header */
.header-nav { display: flex; align-items: center; gap: 0.25rem 1.1rem; }
.header-nav a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.header-nav a:hover { color: var(--accent-deep); text-decoration: underline; }
@media (max-width: 760px) {
  .header-nav { order: 10; flex-basis: 100%; margin-block-start: -0.25rem; }
}
/* phone menu (header-menu.js): a panel under the bar */
.header-menu { display: contents; position: absolute; inset: 100% 0 auto; z-index: 20; padding: 0.25rem 1rem 0.5rem; border-block-end: 1px solid var(--line); background: var(--raised); box-shadow: 0 12px 20px -12px var(--shadow); }
.header-menu hr { display: none; margin-block: 0.25rem; border: 0; border-block-start: 1px solid var(--line); }
.menu-btn { display: none; inline-size: 44px; block-size: 44px; padding: 0; place-items: center; border: 1.5px solid var(--control); border-radius: 50%; background: linear-gradient(var(--btn-top), var(--btn-bottom)); color: var(--ink); cursor: pointer; }
.menu-btn svg { inline-size: 22px; block-size: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
/* home, phone: one 56px row, the burger first */
@media (max-width: 767px) {
  .home .site-header { position: relative; }
  .home .header-bar { flex-wrap: nowrap; gap: 0 0.5rem; min-block-size: 56px; padding-block: 0.25rem; }
  .home .header-bar .wordmark, .home .header-cta { display: none; }
  .home .menu-btn { display: grid; margin-inline-end: auto; }
  .home .header-menu { display: none; }
  .home .menu-open .header-menu { display: block; }
  .home .header-nav { flex-direction: column; align-items: stretch; margin: 0; }
  .home .header-menu hr { display: block; }
  .home .header-menu select { flex: 1; }
}
