/* LaunchSite SEO Tool. Brand tokens mirror the marketing site so the internal tool
   feels like part of the same product. */

:root {
  --paper: #F6F4EF;
  --paper-2: #FFFFFF;
  --ink: #1E2A25;
  --soft: #5C6560;
  --accent: #2E5A4C;
  --accent-2: #6FA98F;
  --line: #E2DED4;
  --line-2: #D5D0C4;

  --red: #A8402F;
  --red-bg: #FBEDEA;
  --amber: #8A6320;
  --amber-bg: #FBF3E3;
  --green: #2E5A4C;
  --green-bg: #EAF1EC;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(30,42,37,.05), 0 10px 30px -18px rgba(30,42,37,.35);

  --sans: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Any rule that sets `display` beats the hidden attribute's display:none, which
   silently leaves hidden panels painted on top of the app. Settle it once here. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }

.muted { color: var(--soft); }
.small { font-size: .85rem; }
.h-serif { font-family: var(--serif); font-weight: 500; letter-spacing: -.015em; }

/* Brand ------------------------------------------------------------------ */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: var(--paper);
  font-family: var(--serif); font-size: .8rem; letter-spacing: .02em;
}
.brand-word { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }
.brand-word em { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--accent); }
.brand-lg .brand-mark { width: 40px; height: 40px; border-radius: 10px; font-size: 1.1rem; }
.brand-lg .brand-word { font-size: 1.35rem; }
.tag {
  margin-left: 4px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--soft);
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
}

/* Gate ------------------------------------------------------------------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: 100%; max-width: 360px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px; display: grid; gap: 14px;
}
.gate-card h1 { font-family: var(--serif); font-weight: 500; font-size: 1.6rem; margin-top: 6px; }
.gate-card input {
  padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); outline: none;
}
.gate-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,90,76,.12); }
.gate-error { color: var(--red); font-size: .9rem; }

/* Shell ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: rgba(246,244,239,.88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 26px 22px 60px; display: grid; gap: 18px; }
/* The topbar is sticky, so anything scrolled to needs to clear its height. */
html { scroll-padding-top: 76px; }
#results { scroll-margin-top: 76px; }
.foot {
  max-width: 1080px; margin: 0 auto; padding: 0 22px 40px;
  display: flex; justify-content: space-between; gap: 12px;
  color: var(--soft); font-size: .82rem;
}

/* Panels ----------------------------------------------------------------- */
.panel {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
}
/* Grid and flex children default to min-width:auto, so one wide table refuses to
   shrink and pushes the whole page sideways. Let them shrink instead. */
.wrap > *, #results > *, .panel, .speed-col, .issue { min-width: 0; }
.panel + .panel, section + section { margin-top: 18px; }
.panel-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.count { color: var(--soft); font-weight: 500; }

.panel-run h1 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
.lede { color: var(--soft); margin-top: 8px; max-width: 62ch; }

/* Form ------------------------------------------------------------------- */
.run-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field-url { flex: 1 1 280px; }
.field-kw { flex: 1 1 240px; }
.field label .opt { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: .7; }
.field label { font-size: .78rem; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select {
  padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); outline: none; width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,90,76,.12); }

.run-opts { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--soft); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.recents { margin-top: 14px; font-size: .85rem; }
.recents button {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 0 6px 0 0; text-decoration: underline; text-underline-offset: 2px;
}

/* Buttons ---------------------------------------------------------------- */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 18px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { background: #26493E; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }

/* Progress --------------------------------------------------------------- */
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-head h2 { font-size: 1rem; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 14px 0 16px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .35s ease; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: .9rem; }
.steps li { display: flex; align-items: center; gap: 9px; color: var(--soft); }
.steps li .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); flex: none; }
.steps li.active { color: var(--ink); }
.steps li.active .dot { background: var(--accent-2); animation: pulse 1.1s ease-in-out infinite; }
.steps li.done .dot { background: var(--accent); }
.steps li.fail .dot { background: var(--red); }
.steps li .note { margin-left: auto; font-variant-numeric: tabular-nums; font-size: .84rem; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Scorecards ------------------------------------------------------------- */
.scorecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card .label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }
.card .value { font-family: var(--serif); font-size: 2.3rem; font-weight: 500; line-height: 1.1; margin-top: 6px; letter-spacing: -.02em; }
.card .sub { font-size: .84rem; color: var(--soft); margin-top: 4px; }
.card .value small { font-size: 1rem; color: var(--soft); }
.v-good { color: var(--green); }
.v-warn { color: var(--amber); }
.v-bad { color: var(--red); }

/* Speed ------------------------------------------------------------------ */
.speed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.speed-col { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.speed-col h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }
.speed-score { font-family: var(--serif); font-size: 2.6rem; line-height: 1.05; font-weight: 500; margin: 8px 0 2px; }
.metrics { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; font-size: .9rem; }
.metrics li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.metrics .m-name { color: var(--soft); }
.metrics .m-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; }
.pill-good { background: var(--green-bg); color: var(--green); }
.pill-warn { background: var(--amber-bg); color: var(--amber); }
.pill-bad { background: var(--red-bg); color: var(--red); }
.speed-note { margin-top: 14px; font-size: .86rem; color: var(--soft); }
.opps-label {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--soft);
}
.opps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: .88rem; }
.opps li { display: flex; justify-content: space-between; gap: 12px; }

/* Search Console --------------------------------------------------------- */
.connect-panel { border-left: 3px solid var(--accent-2); }
.connect-panel .panel-title { margin-bottom: 6px; }
.connect-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

.gsc-totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
  margin-bottom: 20px;
}
/* Column layout with the number pushed to the bottom, so a label that wraps to two
   lines does not knock its number out of line with the cards beside it. */
.gsc-stat {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px;
  display: flex; flex-direction: column;
}
.gsc-stat .value { margin-top: auto; }
.gsc-stat .label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--soft); }
.gsc-stat .value { font-family: var(--serif); font-size: 1.75rem; font-weight: 500; line-height: 1.15; margin-top: 4px; }
.gsc-stat .sub { font-size: .76rem; margin-top: 2px; color: var(--soft); }

.gsc-block + .gsc-block { margin-top: 24px; }
.gsc-block > h3 { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.gsc-block > .table-scroll { margin-top: 10px; }
.plain-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 5px; font-size: .86rem; color: var(--soft); }

/* Content gap ----------------------------------------------------------- */
.gauge { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.gauge-score {
  width: 92px; height: 92px; border-radius: 50%; flex: none;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--g-col) calc(var(--g-pct) * 1%), var(--line) 0);
}
.gauge-score::after {
  content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--paper-2);
}
.gauge-score span {
  position: relative; z-index: 1;
  font-family: var(--serif); font-size: 1.75rem; font-weight: 500;
}
.gauge-meta { flex: 1 1 240px; min-width: 0; }
.gauge-meta h3 { font-size: 1rem; margin-bottom: 4px; }
.gauge-bars { display: grid; gap: 7px; margin-top: 12px; max-width: 420px; }
.gauge-bar { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; font-size: .82rem; }
.gauge-bar .track { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.gauge-bar .fill { height: 100%; background: var(--accent-2); border-radius: 99px; }
.gauge-bar .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--soft); }

.termlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.term {
  font-size: .8rem; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper);
}
.term b { font-weight: 700; color: var(--accent); }
.term.key { border-color: var(--accent-2); background: var(--green-bg); }
.term .n { color: var(--soft); font-size: .72rem; margin-left: 4px; }

.kw-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 10px; }
.kw-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; }
.kw-group h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--soft); margin-bottom: 8px; }
.kw-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .84rem; }

.advice-box { border-left: 3px solid var(--accent-2); padding-left: 14px; margin-top: 6px; }
.advice-box p { margin-bottom: 10px; }
.advice-box .label-sm { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--soft); margin: 14px 0 6px; }
.pri { font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-right: 6px; }
.pri-high { background: var(--red-bg); color: var(--red); }
.pri-medium { background: var(--amber-bg); color: var(--amber); }
.pri-low { background: var(--green-bg); color: var(--green); }

.gap-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; }
.gap-form textarea {
  width: 100%; min-height: 74px; padding: 10px 12px; font: inherit; font-size: .85rem;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper);
  outline: none; resize: vertical; font-family: var(--mono);
}
.gap-form textarea:focus { border-color: var(--accent); }

/* Issues ----------------------------------------------------------------- */
.issue-group + .issue-group { margin-top: 18px; }
.issue-group > h3 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.sev-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sev-critical .sev-dot { background: var(--red); }
.sev-warning .sev-dot { background: var(--amber); }
.sev-notice .sev-dot { background: var(--accent-2); }
.sev-critical > h3 { color: var(--red); }
.sev-warning > h3 { color: var(--amber); }
.sev-notice > h3 { color: var(--soft); }

.issue { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.issue + .issue { margin-top: 8px; }
.issue summary {
  display: flex; align-items: baseline; gap: 10px; cursor: pointer;
  padding: 12px 14px; list-style: none; font-weight: 600;
}
.issue summary::-webkit-details-marker { display: none; }
.issue summary::before { content: '+'; color: var(--soft); font-weight: 400; width: 12px; }
.issue[open] summary::before { content: '\2212'; }
.issue summary .n { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--soft); }
.issue-body { padding: 0 14px 14px 36px; font-size: .9rem; display: grid; gap: 8px; }
.issue-body .why { color: var(--soft); }
.issue-body .fix { color: var(--ink); }
.issue-body .fix b { font-weight: 700; }
.issue-urls { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-family: var(--mono); font-size: .78rem; }
.issue-urls li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-urls a { color: var(--soft); text-decoration: none; }
.issue-urls a:hover { color: var(--accent); text-decoration: underline; }
.all-clear { display: flex; align-items: center; gap: 10px; color: var(--green); font-weight: 600; }

/* Pages table ------------------------------------------------------------ */
.filter {
  padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); outline: none; min-width: 190px;
}
.filter:focus { border-color: var(--accent); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.pages { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.pages th, table.pages td { padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.pages th { background: var(--paper); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); position: sticky; top: 0; }
table.pages tr:last-child td { border-bottom: none; }
table.pages td.num, table.pages th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.pages .u { font-family: var(--mono); font-size: .78rem; max-width: 300px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); text-decoration: none; }
table.pages .u:hover { color: var(--accent); }
table.pages .t { max-width: 260px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st { font-weight: 700; font-variant-numeric: tabular-nums; }
.st-2 { color: var(--green); }
.st-3 { color: var(--amber); }
.st-4, .st-5, .st-0 { color: var(--red); }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }
.flag { font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--amber-bg); color: var(--amber); white-space: nowrap; }
.flag.bad { background: var(--red-bg); color: var(--red); }

/* Report ----------------------------------------------------------------- */
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
pre.report {
  margin: 12px 0 0; padding: 18px; max-height: 520px; overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .78rem; line-height: 1.62;
  white-space: pre-wrap; word-break: break-word;
}

/* Toast ------------------------------------------------------------------ */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow); z-index: 50;
}

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 50px; }
  .panel { padding: 18px 16px; }
  .run-form { flex-direction: column; align-items: stretch; }
  /* flex-basis becomes a height once the form stacks, which stretches the input. */
  .run-form .field-url { flex: 0 0 auto; }
  .run-form .btn { width: 100%; }
  .run-opts { gap: 10px; }
  .report-actions { width: 100%; }
  .report-actions .btn { flex: 1 1 auto; }
  .panel-head { align-items: stretch; }
  .filter { width: 100%; }
  .steps li { flex-wrap: wrap; }
  .steps li .note { margin-left: 16px; }
}
