/* Homepage only: one race entrance, one story, three independent tools. */
.home-page { background: #fbfaf6; color: #20372c; }
main.home-main {
  --home-green: #087b42;
  --home-ink: #193c2c;
  --home-rose: #ae466b;
  --home-violet: #7955a4;
  --home-marigold: #a66b13;
  width: min(1120px, calc(100% - 64px));
  padding: 0;
  margin: 44px auto 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}
.home-main * { box-sizing: border-box; }
.home-main [hidden] { display: none !important; }
.home-main p { padding: 0; }
.home-main a:hover { text-decoration: none; }
.home-main a:focus-visible, .home-main button:focus-visible { outline: 3px solid #009e57; outline-offset: 5px; }
.home-main h2, .home-main h3 {
  margin: 0; padding: 0; border: 0; background: none;
  color: var(--home-ink); border-radius: 0; line-height: 1.5;
}
.home-kicker { margin: 0 0 18px; font-size: 11px; font-weight: 700; letter-spacing: .16em; color: #647c6a; }
.home-kicker::before { content: ""; display: inline-block; width: 20px; height: 5px; border-radius: 4px; margin: 0 9px 2px 0; background: linear-gradient(90deg, #d96b91 0 33%, #a385ce 33% 66%, #e8b744 66%); }
.home-race-hub { display: grid; grid-template-columns: .96fr 1.04fr; grid-template-areas: "copy demo" "races races" "flow flow"; align-items: center; gap: 0 34px; }
.home-hero-copy { grid-area: copy; }
.home-hero-copy h1 { margin: 0; text-align: left; font-size: clamp(36px, 4.2vw, 57px); line-height: 1.4; letter-spacing: -.06em; font-weight: 800; color: var(--home-ink); }
.home-hero-copy h1 span { color: var(--home-green); }
.home-lead { max-width: 420px; margin: 19px 0 25px; color: #56705e; font-size: 14px; line-height: 1.95; }
.home-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.home-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 25px;
  min-height: 50px; padding: 13px 22px; border-radius: 7px;
  background: var(--home-green); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 12px #087b4215;
}
.home-primary:hover { background: #065e32; }
.home-text-link { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: #306345; font-size: 12px; font-weight: 700; }
.home-demo { grid-area: demo; min-width: 0; margin: 0; padding: 10px; border: 1px solid #d9cfe5; border-radius: 14px; background: #fff; box-shadow: 0 12px 40px #7955a413; }
.home-demo-tabs { display: flex; gap: 5px; margin-bottom: 10px; }
.home-demo-tabs button { flex: 1; min-width: 0; min-height: 44px; padding: 8px 6px; border: 1px solid transparent; border-radius: 6px; background: #f6f7f4; color: #65776b; font: inherit; font-size: 12px; cursor: pointer; }
.home-demo-tabs button[aria-selected="true"] { background: #eaf5ed; border-color: #b8d8c1; color: var(--home-green); font-weight: 750; }
.home-demo-viewport { position: relative; display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 6px; }
.home-demo-viewport::-webkit-scrollbar { display: none; }
.home-demo-slide { flex: 0 0 calc(100% - 32px); min-width: 0; scroll-snap-align: start; }
.home-demo-screen { position: relative; overflow: hidden; border-radius: 6px; background: #f0f6ef; aspect-ratio: 16/10; }
.home-demo video { width: 100%; height: 100%; display: block; object-fit: contain; }
.home-demo-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; margin: 4px 0 0; min-height: 44px; color: #27613e; font-size: 11px; line-height: 1.7; }
.home-demo-caption strong { font-weight: 650; }
.home-demo-caption a { display: inline-flex; align-items: center; min-height: 44px; color: #567361; white-space: nowrap; font-size: 10px; }
.home-demo-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; padding-top: 8px; border-top: 1px solid #edf0e9; color: #6b7c70; font-size: 10px; }
.home-demo-controls { display: flex; gap: 5px; }
.home-demo-controls button { min-height: 44px; min-width: 44px; padding: 5px 10px; border: 1px solid #d6e1d7; border-radius: 6px; background: white; color: #306345; font: inherit; font-size: 13px; cursor: pointer; }
.home-demo-controls button:disabled { opacity: .35; cursor: default; }
.home-demo-controls .home-video-toggle { font-size: 11px; }
.home-races { grid-area: races; margin-top: 42px; border-top: 1px solid #dce5db; padding-top: 22px; }
.home-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.home-section-heading > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; }
.home-main .home-section-heading h2 { font-size: 18px; font-weight: 750; }
.home-week { color: #6f8175; font-size: 11px; }
.home-race-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; min-height: 137px; }
.home-race-list[data-card-count="1"] { grid-template-columns: 1fr; }
.home-race-list[data-card-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-race-card { --race-grade-color: #707982; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 137px; padding: 17px 20px; background: #fff; border: 1px solid #dce5dc; border-top: 3px solid var(--race-grade-color); border-radius: 9px; color: var(--home-ink); transition: border-color .15s, box-shadow .15s; }
.home-race-card:hover { border-color: #7ebf94; border-top-color: var(--race-grade-color); box-shadow: 0 4px 15px #193c2c0a; }
/* Match the grade badges in race.html; other classes use neutral gray. */
.home-race-card[data-grade="G1"] { --race-grade-color: #007bff; }
.home-race-card[data-grade="G2"] { --race-grade-color: #ff3c3c; }
.home-race-card[data-grade="G3"] { --race-grade-color: #0fa816; }
.home-race-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #6b7e70; font-size: 11px; }
.home-grade { color: #fff; font-size: 10px; font-weight: 750; padding: 1px 7px; background: var(--race-grade-color); border-radius: 3px; }
.home-race-card strong { margin: 9px 0 8px; font-size: 18px; font-weight: 750; overflow-wrap: anywhere; }
.home-race-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; color: #6e8073; font-size: 11px; }
.home-race-foot span:last-child { color: #287047; font-weight: 700; white-space: nowrap; }
.home-undrawn { align-self: flex-start; margin-bottom: 6px; padding: 1px 5px; border-radius: 3px; background: #fff8e1; color: #e65100; font-size: 10px; font-weight: 700; line-height: 1.4; }
.home-races-state { grid-column: 1/-1; margin: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 20px; border: 1px dashed #c7d7c7; border-radius: 8px; color: #617669; font-size: 13px; }
.home-races-state a { color: var(--home-green); font-size: 12px; text-decoration: underline; }
.home-flow { grid-area: flow; scroll-margin-top: 20px; margin-top: 64px; padding: 34px 32px 24px; border: 1px solid #e5dce6; border-radius: 12px; background: linear-gradient(130deg, #fbf0f4, #f7f2fc 50%, #fff9e9); }
.home-flow .home-kicker { margin-bottom: 8px; font-size: 10px; }
.home-flow h2 { font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -.04em; }
.home-flow-steps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); list-style: none; gap: 30px; margin: 25px 0 18px; padding: 0; counter-reset: home-step; }
.home-flow-steps li { min-width: 0; position: relative; padding-top: 14px; border-top: 1px solid #cbdcca; }
.home-step-number { color: #6d976d; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.home-flow-steps li:nth-child(1) { border-top-color: #dba9bd; }
.home-flow-steps li:nth-child(2) { border-top-color: #c4afdd; }
.home-flow-steps li:nth-child(3) { border-top-color: #e3c47a; }
.home-flow-steps li:nth-child(1) .home-step-number { color: var(--home-rose); }
.home-flow-steps li:nth-child(2) .home-step-number { color: var(--home-violet); }
.home-flow-steps li:nth-child(3) .home-step-number { color: var(--home-marigold); }
.home-flow h3 { margin-top: 5px; font-size: 20px; }
.home-flow-steps p { margin: 8px 0 0; color: #58705e; font-size: 12px; line-height: 1.85; }
.home-flow-note { margin: 0; padding-top: 16px !important; border-top: 1px solid #d7e3d1; color: #6e8171; font-size: 11px; line-height: 1.8; }
.home-flow-note a { color: #39704b; text-decoration: underline; white-space: nowrap; }
.home-tools { margin-top: 48px; }
.home-tools .home-section-heading p { margin: 0; color: #7a897e; font-size: 12px; }
.home-tool-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.home-tool { display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 108px; padding: 18px; border-radius: 8px; border: 1px solid #dce5dc; background: white; color: var(--home-ink); }
.home-tool:hover { border-color: #7ebf94; }
.home-tool-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 8px; color: #4f7b5a; background: #f0f5ed; }
.home-tool:nth-child(1) .home-tool-icon { color: var(--home-violet); background: #f1eaf9; }
.home-tool:nth-child(2) .home-tool-icon { color: var(--home-rose); background: #fbeaf1; }
.home-tool:nth-child(3) .home-tool-icon { color: var(--home-marigold); background: #fff3d7; }
.home-tool svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.home-tool > span:nth-child(2) { min-width: 0; flex: 1; }
.home-tool strong { display: block; font-size: 14px; }
.home-tool small { display: block; margin-top: 5px; font-size: 11px; line-height: 1.7; color: #6b7f70; }
.home-tool-arrow { color: #7a947e; font-size: 17px; }
.home-reading { margin-top: 30px; padding-top: 18px; border-top: 1px solid #dce5dc; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.home-reading .home-text-link { font-size: 12px; }
.home-reading-label { margin-right: 12px; color: #8a9a8b; font-size: 10px; letter-spacing: .1em; }
@media (max-width: 900px) {
  main.home-main { width: calc(100% - 40px); margin-top: 32px; }
  .home-race-hub { column-gap: 24px; }
  .home-hero-copy h1 { font-size: 38px; }
  .home-lead { font-size: 13px; }
  .home-tool { padding: 14px; gap: 10px; }
  .home-tool-icon { flex-basis: 30px; height: 32px; }
}
@media (max-width: 680px) {
  main.home-main { width: calc(100% - 32px); margin-top: 28px; margin-bottom: 38px; }
  .home-race-hub { grid-template-columns: 1fr; grid-template-areas: "copy" "races" "flow" "demo"; gap: 0; }
  .home-kicker { margin-bottom: 12px; font-size: 10px; }
  .home-hero-copy h1 { font-size: clamp(32px, 9.3vw, 43px); line-height: 1.4; letter-spacing: -.05em; }
  .home-lead { max-width: none; margin: 14px 0 18px; font-size: 13px; line-height: 1.9; }
  .home-hero-actions { gap: 10px 18px; }
  .home-primary { min-height: 48px; padding: 12px 18px; font-size: 13px; gap: 20px; }
  .home-demo { transform: none; margin-top: 25px; }
  .home-demo-screen { aspect-ratio: 16/9; }
  .home-races { margin-top: 28px; padding-top: 18px; }
  .home-section-heading { margin-bottom: 10px; }
  .home-main .home-section-heading h2 { font-size: 17px; }
  .home-race-list, .home-race-list[data-card-count="2"], .home-tool-list { grid-template-columns: 1fr; gap: 9px; }
  .home-race-list { min-height: 108px; }
  .home-race-card { padding: 13px 16px; min-height: 112px; }
  .home-race-card strong { font-size: 18px; margin: 6px 0; }
  .home-flow { margin-top: 36px; padding: 25px 20px 20px; }
  .home-flow h2 { font-size: 23px; }
  .home-flow-steps { grid-template-columns: 1fr; gap: 16px; margin-top: 20px; }
  .home-flow-steps li { padding-top: 13px; padding-left: 35px; }
  .home-step-number { position: absolute; left: 0; top: 16px; }
  .home-flow h3 { margin-top: 0; font-size: 18px; }
  .home-flow-steps p { margin-top: 5px; }
  .home-tools { margin-top: 34px; }
  .home-tool { min-height: 85px; padding: 15px 17px; gap: 15px; }
  .home-tool-icon { flex-basis: 37px; height: 37px; }
  .home-tool strong { font-size: 15px; }
  .home-reading { margin-top: 24px; }
  .home-reading .home-text-link { font-size: 11px; }
  .home-reading-label { margin-right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .home-main * { transition: none !important; scroll-behavior: auto !important; }
}
