/* =====================================================================
   CallYourRep.AI — styles
   Palette: white paper, navy ink, red for anything that takes action.
   Type:    Oswald (display, set in caps), Source Serif 4 (body).
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper: #ffffff;
  --surface: #f5f6f8;
  --ink: #0b2545;
  --muted: #55606e;
  --rule: #d8dde4;
  --rule-strong: #b3bcc7;
  --navy: #0b2545;
  --navy-soft: #e7edf6;
  --call: #b91c2b;
  --call-hover: #9a1522;
  --call-soft: #fbe9eb;
  --call-text: #ffffff;
  --danger: #b42318;
  --focus: #0b2545;
  --display: "Oswald", "Arial Narrow", Impact, "Franklin Gothic Medium", sans-serif;
  --body: "Source Serif 4", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; }
h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
  text-transform: uppercase;
  text-wrap: balance;
}
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.15; letter-spacing: .02em; text-transform: uppercase; }
h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.2; letter-spacing: .01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 40rem; }
.wrap { width: min(100% - 2.5rem, 64rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.top { background: var(--navy); color: #fff; border-bottom: 5px solid var(--call); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 54px; }
.brand {
  font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: #fff; text-decoration: none;
  letter-spacing: .02em; white-space: nowrap;
}
.brand:hover { text-decoration: underline; text-underline-offset: 4px; }
.top :focus-visible { outline-color: #fff; }
.top-right { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }

/* ---------- Share icons (top bar and bottom) ---------- */
.share-icons { display: flex; gap: .35rem; flex-wrap: wrap; }
.share-btn {
  width: 32px; height: 32px; padding: 0; border-radius: 4px;
  border: 1px solid var(--rule-strong); background: transparent; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background-color .12s, border-color .12s;
}
.share-btn:hover { background: var(--surface); border-color: var(--ink); }
.share-top .share-btn { color: #fff; border-color: rgba(255, 255, 255, .45); }
.share-top .share-btn:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.share-btn svg { width: 16px; height: 16px; }
.share-bottom { gap: .5rem; margin-top: .9rem; }
.share-bottom .share-btn { width: 42px; height: 42px; border-radius: 4px; }
.share-bottom .share-btn svg { width: 20px; height: 20px; }

/* ---------- Hero ---------- */
.hero { padding: 2rem 0 1.5rem; }
.hero h1 { margin-bottom: 1.1rem; }

.finder { position: relative; }
.finder-bar { display: flex; gap: .45rem; align-items: stretch; }
.finder-input { position: relative; flex: 1 1 auto; min-width: 0; }
.finder-icon {
  position: absolute; left: .8rem; top: 50%; width: 19px; height: 19px; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
#address, .name-input {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--rule-strong); border-radius: 4px; padding: .65rem .85rem;
}
#address { width: 100%; height: 100%; padding-left: 2.5rem; }
.name-input { flex: 0 0 13rem; }
#address::placeholder, .name-input::placeholder { color: var(--muted); }
#address:focus, .name-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
#address[aria-expanded="true"] { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.btn-find { flex: 0 0 auto; padding-inline: 1.4rem; font-size: 1.05rem; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.form-error { color: var(--danger); font-weight: 600; margin-top: .5rem; font-size: .95rem; }

/* ---------- Address suggestions ---------- */
.suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  margin: 0; padding: .35rem; list-style: none;
  background: var(--surface); border: 1.5px solid var(--ink); border-top: 0;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 12px 28px rgba(11, 37, 69, .12);
}
.suggest li { display: grid; gap: .05rem; padding: .5rem .75rem; border-radius: 3px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--paper); }
.suggest .s-main { font-weight: 600; font-size: .95rem; }
.suggest .s-sub { font-size: .85rem; color: var(--muted); }
.suggest .s-note { cursor: default; color: var(--muted); font-size: .85rem; padding-block: .45rem; }
.suggest .s-note:hover { background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-family: var(--display); font-weight: 600; font-size: 1rem; line-height: 1.2;
  letter-spacing: .05em; text-transform: uppercase;
  padding: .65rem 1rem; border-radius: 4px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-call { background: var(--call); color: var(--call-text); }
.btn-call:hover { background: var(--call-hover); }
.btn-quiet { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-quiet:hover { background: var(--surface); border-color: var(--ink); }
.btn-icon { width: 18px; height: 18px; flex: none; }

/* ---------- Results ---------- */
.results { padding: 1.4rem 0 1.75rem; border-top: 1px solid var(--rule); }
.results-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; }
.notice { background: var(--navy-soft); border-left: 4px solid var(--navy); border-radius: 4px; padding: .65rem .9rem; font-size: .95rem; margin-bottom: 1rem; }

.reps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .reps { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: no-preference) {
  .reps { animation: rise .35s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

.rep {
  background: var(--paper); border: 1px solid var(--rule); border-top: 4px solid var(--navy); border-radius: 4px;
  padding: 1rem; display: grid; gap: .75rem; align-content: start;
}
.rep.is-done { border-top-color: var(--call); }
.expand-btn { display: none; }
@media (max-width: 899px) {
  /* On phones only the first rep's script is open; the rest wait behind a button so the page stays short. */
  .rep.collapsed .seg, .rep.collapsed .panel { display: none !important; }
  .rep.collapsed .expand-btn { display: inline-flex; }
}
.rep-head { display: grid; grid-template-columns: 48px 1fr; gap: .75rem; align-items: center; }
.rep-photo {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; object-position: top;
  background: var(--surface); border: 1px solid var(--rule);
}
.rep-name { font-size: 1.25rem; }
.rep-role, .rep-line { font-size: .85rem; color: var(--muted); line-height: 1.35; }
.rep-line { display: flex; gap: .75rem; margin-top: .1rem; }
.rep-line a { color: var(--muted); }
.rep-line a:hover { color: var(--ink); }
.rep .btn-call { font-size: 1rem; padding-block: .7rem; }
.rep .call-link.no-phone { background: var(--surface); color: var(--muted); cursor: default; }

.seg { display: inline-flex; gap: .2rem; padding: .2rem; background: var(--surface); border-radius: 4px; align-self: start; }
.seg-btn {
  font: inherit; font-family: var(--display); font-weight: 500; font-size: .9rem; letter-spacing: .04em; text-transform: uppercase;
  background: transparent; border: 0; padding: .3rem .7rem; border-radius: 3px; color: var(--muted); cursor: pointer;
}
.seg-btn.active { background: var(--navy); color: #fff; }

.panel { display: grid; gap: .5rem; }
.script-wrap { position: relative; }
.script, .script-subject {
  width: 100%; font: inherit; font-size: .925rem; line-height: 1.5; color: var(--ink);
  background: var(--surface); border: 1px solid transparent; border-radius: 4px;
  padding: .65rem 2.4rem .65rem .75rem;
}
.script { resize: none; overflow: hidden; display: block; }
.script:focus, .script-subject:focus { outline: none; border-color: var(--rule-strong); background: var(--paper); }
.copy-btn {
  position: absolute; top: .35rem; right: .35rem; width: 28px; height: 28px; padding: 0;
  border-radius: 3px; border: 1px solid var(--rule); background: var(--paper); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.copy-btn:hover { color: var(--ink); border-color: var(--ink); }
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn.copied { color: var(--navy); border-color: var(--navy); }
.tip { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.tip a { color: var(--muted); }
.tip a:hover { color: var(--ink); }

.done {
  display: flex; align-items: center; gap: .55rem; font-size: .9rem; color: var(--muted); font-weight: 600;
  cursor: pointer; user-select: none; padding-top: .65rem; border-top: 1px solid var(--rule);
}
.done input { width: 18px; height: 18px; margin: 0; accent-color: var(--call); }
.rep.is-done .done { color: var(--call); }

/* ---------- Why this matters ---------- */
.why { padding: 1.75rem 0; border-top: 1px solid var(--rule); }
.why-head .lede { margin-top: .5rem; max-width: 44rem; }
.points { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
@media (min-width: 720px) { .points { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
.point { border-top: 3px solid var(--call); padding-top: .7rem; }
.point h3 { font-size: 1.1rem; margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .02em; }
.point p { color: var(--muted); font-size: .925rem; }

/* ---------- Closing: share + learn more ---------- */
.closing { padding: 1.75rem 0 2.5rem; border-top: 1px solid var(--rule); }
.closing-grid { display: grid; gap: 1.75rem; align-items: start; }
@media (min-width: 720px) { .closing-grid { grid-template-columns: 1.4fr 1fr; gap: 3rem; } }
.share h2 { font-size: 1.3rem; }
.share .muted { margin-top: .25rem; }

.learn label { display: block; font-family: var(--display); font-weight: 600; font-size: 1.3rem; letter-spacing: .02em; text-transform: uppercase; }
.learn-row { display: flex; gap: .5rem; margin-top: .6rem; }
.learn-row input {
  flex: 1 1 10rem; min-width: 0; font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--rule-strong); border-radius: 4px; padding: .6rem .8rem;
}
.learn-row input:focus { outline: none; border-color: var(--ink); }
.form-msg { margin-top: .5rem; font-size: .9rem; font-weight: 600; }
.form-msg.ok { color: var(--navy); }
.form-msg.err { color: var(--danger); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: .55rem 1rem; border-radius: 4px;
  font-weight: 600; font-size: .9rem; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 40;
  max-width: calc(100% - 2rem); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Medium screens ---------- */
@media (max-width: 760px) {
  .finder-bar { flex-wrap: wrap; }
  .finder-input { flex: 1 1 100%; }
  .name-input { flex: 1 1 10rem; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .wrap { width: min(100% - 1.5rem, 64rem); }
  .top-row { gap: .5rem; }
  .brand { font-size: 1rem; }
  .top-right { gap: .6rem; }
  /* In the top bar on phones, one share button is enough: the phone's own share sheet if it has one, else copy link */
  .share-top .share-btn { display: none; }
  .share-top .share-copy { display: inline-flex; }
  .share-top.has-native .share-copy { display: none; }
  .share-top.has-native .share-native { display: inline-flex; }
  #address[aria-expanded="true"] { border-radius: 4px 4px 0 0; }
  .btn-find { flex: 1 1 100%; padding-block: .75rem; }
  .suggest { top: calc(100% - 1px); }
}
