/* Fraunces (Undercase Type) and Outfit (Outfitio), SIL Open Font License.
   License texts: ./fonts/OFL-fraunces.txt and ./fonts/OFL-outfit.txt */
@font-face {
  font-family: Fraunces;
  font-style: normal;
  font-weight: 560 680;
  font-display: swap;
  src: url("./fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Fraunces;
  font-style: normal;
  font-weight: 560 680;
  font-display: swap;
  src: url("./fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 400 640;
  font-display: swap;
  src: url("./fonts/outfit-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 400 640;
  font-display: swap;
  src: url("./fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #e6dfd2;
  --ink: #1c1914;
  --muted: #5c564c;
  --line: #d5cbbd;
  --surface: #fbf7f0;
  --field: #fffdf9;
  --accent: #1b3c33;
  --accent-ink: #f4f8e6;
  --danger: #8d2b22;
  --ok: #1c6a42;
  --focus: #1b3c33;
  --glow: rgba(214, 196, 92, 0.45);
  --shadow: 0 22px 50px rgba(48, 36, 16, 0.12);
  --sans: Outfit, "Segoe UI", sans-serif;
  --serif: Fraunces, Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110e;
    --ink: #f4efe6;
    --muted: #c4baad;
    --line: #343028;
    --surface: #1c1a16;
    --field: #141310;
    --accent: #e4f27a;
    --accent-ink: #17200c;
    --danger: #ffb4a8;
    --ok: #b7e3a8;
    --focus: #e4f27a;
    --glow: rgba(228, 242, 122, 0.14);
    --shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  background:
    radial-gradient(880px 420px at 100% -10%, var(--glow), transparent 60%),
    var(--bg);
}

button, input, textarea { font: inherit; color: inherit; }

button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 520;
  font-size: 14px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

button:disabled { opacity: 0.4; cursor: not-allowed; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.swatch:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.shell { max-width: 1080px; margin: 0 auto; padding: 22px 22px 40px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 680;
  font-size: 40px;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.lede { margin: 8px 0 0; max-width: 42ch; color: var(--muted); }

.actions, .tools, .visit-bar { display: flex; flex-wrap: wrap; gap: 8px; }

.note {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 14px;
}

.note:empty { display: none; }
.note.err { color: var(--danger); }
.note.ok { color: var(--ok); }
.note button { margin-left: 6px; padding: 4px 10px; }

.tabs {
  display: none;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 0;
}

.tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: transparent;
}

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

.editor, .stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.editor { padding: 18px; }

.stage {
  padding: 16px;
  position: sticky;
  top: 12px;
  background:
    linear-gradient(180deg, transparent, transparent),
    var(--surface);
}

.stage-label, .section-head h2, legend {
  font-size: 13px;
  font-weight: 640;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stage-label { margin: 2px 4px 12px; }

.pair, .stack-fields { display: grid; gap: 12px; }
.pair { grid-template-columns: 1fr 1fr; }

label, .field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--field);
}

textarea { resize: vertical; min-height: 58px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

fieldset { border: 0; margin: 16px 0; padding: 0; }
legend { padding: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.swatch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
}

.swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.swatch:has(input:checked) {
  border-color: var(--ink);
  background: var(--field);
}

.pip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--p-bg), var(--p-bg2));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 4px;
}

.section-head h2 { margin: 0; }
.section-head span { color: var(--muted); font-size: 13px; }

.quiet { margin: 6px 0 10px; color: var(--muted); font-size: 13px; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
}

.row.is-dragging { opacity: 0.45; }
.row.is-over { outline: 2px solid var(--focus); }

.grip {
  cursor: grab;
  color: var(--muted);
  padding: 6px 2px;
  letter-spacing: -0.15em;
  user-select: none;
}

.row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.row-title { font-weight: 640; }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.host { color: var(--muted); font-size: 12px; }

.track {
  height: 4px;
  margin: 6px 0 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.bar {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

.row-actions { display: flex; gap: 4px; }
.row-actions button { width: 34px; height: 34px; padding: 0; }

.add {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.tools { margin-top: 16px; }

.phone {
  --p-bg: #14122a;
  --p-bg2: #2a2158;
  --p-ink: #f6f3ff;
  --p-muted: #c9c2e4;
  --p-btn: rgba(255, 255, 255, 0.1);
  --p-btn-ink: #fff;
  border-radius: 28px;
  padding: 26px 20px 18px;
  color: var(--p-ink);
  background: linear-gradient(180deg, var(--p-bg), var(--p-bg2));
  text-align: center;
}

.theme-midnight { --p-bg: #14122a; --p-bg2: #2a2158; --p-ink: #f6f3ff; --p-muted: #c9c2e4; --p-btn: rgba(255, 255, 255, 0.1); --p-btn-ink: #fff; }
.theme-sunset { --p-bg: #d85a32; --p-bg2: #f0b15f; --p-ink: #2a120c; --p-muted: #5a2916; --p-btn: #fff8f2; --p-btn-ink: #2a120c; }
.theme-paper { --p-bg: #f6f0e4; --p-bg2: #e7dcc8; --p-ink: #1c1915; --p-muted: #5e564b; --p-btn: #1c1915; --p-btn-ink: #f6f0e4; }
.theme-grove { --p-bg: #12352c; --p-bg2: #1f6a4e; --p-ink: #f3f7f2; --p-muted: #c5ddd2; --p-btn: rgba(255, 255, 255, 0.1); --p-btn-ink: #f3f7f2; }
.theme-candy { --p-bg: #b01258; --p-bg2: #6436e8; --p-ink: #fff; --p-muted: #ffd6e8; --p-btn: #fff; --p-btn-ink: #351048; }

.avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 680;
  background: color-mix(in srgb, var(--p-ink) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--p-ink) 28%, transparent);
}

.phone h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 680;
  font-size: 32px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.handle { margin: 4px 0 0; color: var(--p-muted); }
.bio { margin: 10px auto 0; max-width: 28ch; color: var(--p-ink); }
.ghost { opacity: 0.55; }

.stack { margin-top: 18px; display: grid; gap: 10px; text-align: left; }

.plink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--p-btn);
  color: var(--p-btn-ink);
  text-decoration: none;
}

.plink strong { display: block; font-weight: 640; }
.plink small { display: block; margin-top: 2px; opacity: 0.72; font-size: 12px; font-weight: 400; }
.plink:focus-visible { outline: 2px solid var(--p-ink); outline-offset: 2px; }

.empty {
  margin: 8px 0;
  padding: 22px 12px;
  border: 1px dashed color-mix(in srgb, var(--p-ink) 40%, transparent);
  border-radius: 14px;
  color: var(--p-muted);
  text-align: center;
}

.brand {
  margin: 18px 0 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--p-muted);
}

.visit {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px 40px;
}

.visit-card { width: min(380px, 100%); }
.visit .phone { box-shadow: var(--shadow); }
.visit-bar { justify-content: center; margin-top: 16px; }
.visit .note { text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .plink { transition: transform 0.15s ease; }
  .plink:hover { transform: translateY(-1px); }
}

@media (max-width: 860px) {
  .tabs { display: flex; position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--bg) 92%, transparent); padding-bottom: 10px; }
  .desk { grid-template-columns: 1fr; }
  .stage { position: static; }
  .panel-edit #stage { display: none; }
  .panel-preview #editor { display: none; }
  .panel-preview .lede,
  .panel-preview .eyebrow { display: none; }
  .panel-preview h1 { font-size: 28px; }
  .top { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .shell { padding: 16px 14px 28px; }
  h1 { font-size: 34px; }
  .pair, .add { grid-template-columns: 1fr; }
  .add button { width: 100%; }
  .grip { display: none; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row-actions { justify-content: flex-end; }
  .row-title { line-height: 1.25; }
  .row-actions button { width: 40px; height: 40px; }
}
