/*
 * CALP-DIAGNOSIS-RESULT-006 — diagnosis.css
 *
 * Standalone stylesheet for site/diagnosis/. Does not load styles.css.
 * Reuses the LP's approved color tokens / font / corner-radius language
 * but does not reuse Snap markup or Snap-specific CSS.
 */

:root {
  --paper: #fffaf3;
  --ink: #07111c;
  --orange: #ef3c0b;
  --orange-pale: #ffe3cf;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* UA [hidden] must win over author display rules below (e.g. .diag-question,
   .diag-result use display:flex). Without this, [hidden] has no visible effect
   and all question sections + the result section render simultaneously. */
[hidden] { display: none !important; }

/* JS-disabled fallback: keep only the <noscript> notice visible.
   diagnosis.js removes the .no-js class as its first statement. */
.no-js .diag-main { display: none; }
.no-js .diag-result { display: none; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a, input { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, p, fieldset, legend { margin: 0; padding: 0; border: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.diag-noscript {
  padding: 24px;
  text-align: center;
}
.diag-noscript a {
  display: inline-block;
  margin-top: 12px;
  color: var(--orange);
  font-weight: 700;
  text-decoration: underline;
}

.diag-app {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}

/* ---------- Topbar / progress ---------- */

.diag-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 14px;
}

.diag-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px 0 0;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}
.diag-back::before {
  content: "‹";
  display: inline-block;
  margin-right: 2px;
  color: var(--orange);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}
.diag-back:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 8px;
}

.diag-progress-text {
  color: #5a5049;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}

.diag-progressbar {
  width: 100%;
  height: 6px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--orange-pale);
}
.diag-progressbar__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(98deg, #ef2307, #f75418);
  transition: width .18s ease;
}
@media (prefers-reduced-motion: reduce) {
  .diag-progressbar__fill { transition: none; }
}

/* ---------- Question screens ---------- */

.diag-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.diag-question {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

/* Heading + fieldset are centered together as a single group in the
   remaining space below the topbar/progress bar (same margin:auto 0
   technique as the LP's .snap__block). On short viewports where the
   group does not fit, the auto margins collapse to 0 instead of
   clipping the top, so the block sits flush at the top and the page
   scrolls naturally. */
.diag-question__block {
  width: 100%;
  margin: auto 0;
}

.diag-question__title {
  margin-bottom: 28px;
  color: var(--ink);
  font-size: clamp(21px, 6.4vw, 26px);
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: -.02em;
}
.diag-question__title:focus-visible {
  outline: none;
}

.diag-fieldset {
  display: block;
}

.diag-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(88px, 1fr);
  gap: 12px;
}

.diag-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 14px;
  border: 1.5px solid rgba(7,17,28,.12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(7,17,28,.05);
  text-align: center;
  cursor: pointer;
}

.diag-card input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.diag-card span {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

/* Selected state: JS toggles .is-selected on the label (primary signal,
   works in every browser). :has() is kept as a CSS-only reinforcement
   for browsers where it is supported, in case JS/CSS ever drift. */
.diag-card.is-selected,
.diag-card:has(input:checked) {
  border-color: var(--orange);
  background: var(--orange-pale);
  box-shadow: 0 6px 14px rgba(239,60,11,.16);
}
.diag-card.is-selected span,
.diag-card:has(input:checked) span {
  color: var(--orange);
}

/* Focus-visible state: JS toggles .is-focused on the label (primary
   signal). :has(:focus-visible) is kept as a CSS-only reinforcement. */
.diag-card.is-focused,
.diag-card:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.diag-card {
  transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
@media (prefers-reduced-motion: reduce) {
  .diag-card { transition: none; }
}

/* ---------- Result screen ---------- */

.diag-result {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.diag-result__title {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: clamp(24px, 7vw, 28px);
  font-weight: 900;
  letter-spacing: -.02em;
}
.diag-result__title:focus-visible {
  outline: none;
}

.diag-result__block {
  padding: 18px 20px;
  border: 1.5px solid var(--orange-pale);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(7,17,28,.06);
}

.diag-result__label {
  margin-bottom: 8px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
}

.diag-result__block--secondary .diag-result__label {
  color: #5a5049;
}

.diag-result__service {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.diag-result__copy {
  color: #26221f;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

.diag-result__actions {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.diag-result__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.diag-result__cta--primary {
  color: #fff;
  background: linear-gradient(98deg, #ef2307, #f75418);
  box-shadow: 0 10px 20px rgba(239,60,11,.2);
}

.diag-result__cta--secondary {
  border: 2px solid var(--orange);
  color: var(--orange);
  background: #fff;
}

.diag-result__cta:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Small-height fallback ---------- */

@media (max-height: 700px) {
  .diag-app { min-height: 100%; }
  .diag-cards { grid-auto-rows: minmax(72px, auto); }
  .diag-card { min-height: 72px; }
}
