/* GRUND app layer (brand-system readme): platform font, light default + dark opt-in, real
   elevation, 10/8/6px radii, borders that go to the accent on anything actionable. Every colour
   comes from tokens/app.css. */
:root { color-scheme: light dark; }
[data-app-theme="light"] { color-scheme: light; }
[data-app-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: var(--app-font);
  background: var(--app-bg);
  color: var(--app-fg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--app-accent-soft); color: var(--app-fg); }
:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
input { caret-color: var(--app-accent); }
b { font-weight: 620; }

/* ── header: the one translucent surface the app layer allows ── */
.bar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 24px;
  background: color-mix(in srgb, var(--app-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-line);
}
.brand { font-size: 15.5px; font-weight: 650; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  font: inherit; font-size: 15px; color: var(--app-fg);
  background: transparent; border: 1px solid var(--app-line); border-radius: var(--app-radius-sm);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--app-line-strong); }

main { max-width: 1080px; margin: 0 auto; padding: 40px 24px 96px; }

.intro h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.1; font-weight: 650; letter-spacing: -0.02em; }
.intro p { margin: 0; max-width: 56ch; color: var(--app-fg-muted); }

.work {
  display: grid; gap: 24px; align-items: start; margin-top: 32px;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
}

.panel {
  background: var(--app-bg-raised);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  padding: 20px;
}

/* ── form ── */
fieldset { margin: 0 0 18px; padding: 0; border: 0; }
legend, label { display: block; margin-bottom: 6px; padding: 0; font-size: 13.5px; font-weight: 600; }
.opt { margin-left: 4px; font-weight: 400; color: var(--app-fg-muted); white-space: nowrap; }

.segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px;
  background: var(--app-bg-zone); border: 1px solid var(--app-line); border-radius: var(--app-radius-sm);
}
.segmented label { margin: 0; font-weight: 600; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; padding: 7px 10px; text-align: center; font-size: 14px;
  color: var(--app-fg-muted); border-radius: 6px; cursor: pointer;
  transition: background-color .14s ease, color .14s ease;
}
/* a hairline, not a shadow: raised-on-zone is a 2% step in the dark theme and would not show */
.segmented input:checked + span { background: var(--app-bg-raised); color: var(--app-fg); box-shadow: inset 0 0 0 1px var(--app-line-strong); }
.segmented input:focus-visible + span { outline: 2px solid var(--app-accent); outline-offset: 1px; }

.field { margin-bottom: 14px; }
.field input {
  display: block; width: 100%; padding: 10px 12px;
  font: inherit; color: var(--app-fg);
  background: var(--app-bg-raised);
  border: 1px solid var(--app-line-strong); border-radius: var(--app-radius-sm);
  transition: border-color .14s ease;
}
.field input::placeholder { color: var(--app-fg-muted); opacity: 1; }
.field input:hover { border-color: var(--app-fg-muted); }
.field input:focus { outline: none; border-color: var(--app-accent); box-shadow: 0 0 0 3px var(--app-accent-soft); }
.field input[aria-invalid="true"] { border-color: var(--app-danger); }
.msg { margin: 5px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--app-fg-muted); }
.msg:empty { display: none; }
.msg.bad { color: var(--app-danger); }
.note { margin: 18px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--app-fg-muted); }

/* ── preview ── */
.preview h2, .guide h2 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; }
.preview h2 { color: var(--app-fg-muted); }
.mail {
  padding: 28px 28px 24px;
  background: var(--app-bg-raised); color: var(--app-fg);
  border: 1px solid var(--app-line); border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  font: 13px/1.5 Arial, Helvetica, sans-serif; /* what Gmail composes in */
  overflow-x: auto;
}
.mail-body { margin: 0 0 16px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px;
  font: inherit; font-size: 14.5px; font-weight: 600; text-decoration: none;
  color: var(--app-accent-ink); background: var(--app-accent);
  border: 1px solid var(--app-accent); border-radius: var(--app-radius-sm);
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease;
}
.btn:hover { background: color-mix(in srgb, var(--app-accent) 86%, var(--app-fg)); }
.btn:active { background: color-mix(in srgb, var(--app-accent) 76%, var(--app-fg)); transition: none; }
#copy { min-width: 196px; }
.link-btn {
  padding: 4px 0; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--app-accent); background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--app-accent) 40%, transparent);
}
.link-btn:hover { text-decoration-color: currentColor; }
.status { min-height: 1.45em; margin: 12px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--app-fg-muted); }
.status.bad { color: var(--app-danger); }

/* ── guide ── */
.guide { margin-top: 32px; padding: 24px; scroll-margin-top: 72px; }
.guide:not([hidden]) { animation: reveal .26s cubic-bezier(.2, .7, .3, 1); }
.desk-only { display: none; margin: 0 0 18px; padding: 12px 14px; font-size: 14px; line-height: 1.45; background: var(--app-accent-soft); border-radius: var(--app-radius-sm); }
.guide-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.guide h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; max-width: 72ch; }
.steps li { position: relative; padding: 0 0 14px 40px; counter-increment: step; }
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; display: grid; place-items: center;
  font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--app-accent); background: var(--app-accent-soft); border-radius: 99px;
}
.em { font-weight: 600; }
[data-signame] { white-space: nowrap; }
kbd {
  padding: 1px 6px; font-family: var(--app-font-mono); font-size: 12.5px;
  background: var(--app-bg-zone); border: 1px solid var(--app-line-strong); border-bottom-width: 2px; border-radius: 5px;
}

@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 860px) {
  .work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .desk-only { display: block; }
  .field input { font-size: 16px; } /* under 16px iOS Safari zooms on focus */
  .link-btn { padding: 10px 0; }    /* 44px-class touch targets */
  .segmented span { padding: 11px 10px; }
  .icon-btn { width: 40px; height: 40px; }
  .bar { padding: 0 14px; }
  main { padding: 28px 14px 72px; }
  .intro h1 { font-size: 26px; }
  .mail { padding: 20px 18px; }
  .guide { padding: 20px 18px; }
  .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .guide:not([hidden]) { animation-name: fade; animation-duration: .18s; }
  @keyframes fade { from { opacity: 0; } }
  * { scroll-behavior: auto !important; }
}
