:root {
  color-scheme: light;
  --ink: #17233a;
  --ink-soft: #536072;
  --paper: #f4f0e7;
  --surface: #fffdf8;
  --surface-blue: #edf3f6;
  --line: #d9d4c8;
  --navy: #102d4f;
  --blue: #1e6070;
  --orange: #dd6f45;
  --gold: #d6a447;
  --green: #3f725d;
  --red: #9c493d;
  --shadow: 0 24px 70px rgba(24, 35, 58, 0.14);
  --radius: 18px;
  font-family: Inter, "Segoe UI", "Noto Sans JP", "Yu Gothic UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 2%, rgba(214, 164, 71, 0.16), transparent 29rem),
    linear-gradient(180deg, #f8f5ed 0, var(--paper) 32rem);
  min-height: 100vh;
}

body.detail-open {
  overflow: hidden;
}

button,
select,
a {
  font: inherit;
}

button,
select {
  color: inherit;
}

a {
  color: var(--blue);
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(221, 111, 69, 0.45);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.7rem;
  left: 0.7rem;
  padding: 0.7rem 1rem;
  color: white;
  background: var(--navy);
  border-radius: 8px;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1220px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.35rem 0;
  border-bottom: 1px solid rgba(23, 35, 58, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  color: white;
  background: var(--navy);
  border-radius: 50%;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 1.2rem;
}

.brand small {
  margin-top: 0.12rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dataset-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(214, 164, 71, 0.18);
}

.dataset-status.ready .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(63, 114, 93, 0.16);
}

.dataset-status.error .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(156, 73, 61, 0.14);
}

main {
  width: min(1220px, calc(100% - 3rem));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(19rem, 0.6fr);
  gap: 4rem;
  align-items: end;
  padding: 5.4rem 0 4.8rem;
}

.hero,
.hero-copy,
.hero-meta,
.hero-meta > div,
.workspace,
.filters,
.results {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 13ch;
  margin-bottom: 1.35rem;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(3rem, 6.4vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

h1 em {
  display: block;
  color: var(--orange);
  font-weight: 500;
}

.lede {
  max-width: 40rem;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.65;
}

.hero-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 45px rgba(23, 35, 58, 0.08);
}

.hero-meta > div {
  min-height: 9rem;
  padding: 1.45rem;
  background: rgba(255, 253, 248, 0.92);
}

.metric,
.metric-label {
  display: block;
}

.metric {
  margin-bottom: 2.2rem;
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 3.2rem;
  line-height: 1;
}

.metric-small {
  padding-top: 0.45rem;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
}

.metric-label {
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr);
  gap: 3.2rem;
  padding: 3.2rem 0 5rem;
  border-top: 1px solid rgba(23, 35, 58, 0.14);
}

.filters {
  align-self: start;
  position: sticky;
  top: 1.5rem;
}

.section-heading h2,
.results-header h2 {
  margin-bottom: 2rem;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 1.75rem;
  font-weight: 500;
}

.filter-control {
  display: block;
  margin-bottom: 1.15rem;
}

.filter-control > span {
  display: block;
  margin-bottom: 0.42rem;
  color: var(--ink-soft);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

select {
  width: 100%;
  padding: 0.82rem 2.4rem 0.82rem 0.9rem;
  background: var(--surface) no-repeat right 0.85rem center;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
}

.text-button {
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.boundary-note {
  margin-top: 2.5rem;
  padding: 1.1rem 1.15rem;
  background: var(--surface-blue);
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
}

.boundary-note strong {
  font-family: Georgia, serif;
  font-size: 0.95rem;
}

.boundary-note p {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.55;
}

.results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.results-header h2 {
  margin-bottom: 0;
}

.result-count {
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.notice {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  color: #71401f;
  background: #fae9d7;
  border: 1px solid #edcba8;
  border-radius: 10px;
  font-size: 0.8rem;
}

.opportunity-list {
  display: grid;
  gap: 0.9rem;
}

.opportunity-card {
  display: grid;
  grid-template-columns: 0.7rem minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  width: 100%;
  min-height: 12rem;
  padding: 1.5rem 1.5rem 1.5rem 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(23, 35, 58, 0.045);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.opportunity-card:hover {
  transform: translateY(-2px);
  border-color: #b9b3a8;
  box-shadow: 0 14px 38px rgba(23, 35, 58, 0.09);
}

.card-accent {
  align-self: stretch;
  background: var(--blue);
  border-radius: 0 10px 10px 0;
}

.opportunity-card[data-confidence="high"] .card-accent {
  background: var(--green);
}

.opportunity-card[data-confidence="moderate"] .card-accent {
  background: var(--gold);
}

.opportunity-card[data-confidence="low"] .card-accent {
  background: var(--orange);
}

.card-topline,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.25rem 0.55rem;
  color: var(--navy);
  background: var(--surface-blue);
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.tag-confidence {
  color: #315a48;
  background: #e5f0ea;
}

.card-title-ja {
  margin: 0.85rem 0 0.45rem;
  color: var(--ink);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, serif;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.4;
}

.card-title-en {
  margin-bottom: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.card-summary {
  display: -webkit-box;
  overflow: hidden;
  max-width: 48rem;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-side {
  min-width: 8.2rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.deadline-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.deadline-value {
  display: block;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
}

.arrow {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-top: 1.3rem;
  color: white;
  background: var(--navy);
  border-radius: 50%;
}

.state-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.state-card > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  color: white;
  background: var(--blue);
  border-radius: 50%;
  font-weight: 800;
}

.state-card strong {
  display: block;
  margin-bottom: 0.3rem;
}

.state-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}

.state-card-error > span {
  background: var(--red);
}

.loading-mark::after {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.detail-shell {
  position: fixed;
  z-index: 50;
  inset: 0;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 25, 43, 0.55);
  border: 0;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(49rem, 92vw);
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem clamp(1.4rem, 4vw, 3.5rem) 4rem;
  background: var(--surface);
  box-shadow: -20px 0 65px rgba(12, 25, 43, 0.22);
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.8rem;
}

.close-button {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.55rem;
  line-height: 1;
}

.detail-title-ja {
  max-width: 19ch;
  margin: 1.1rem 0 0.7rem;
  font-family: "Yu Mincho", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.23;
}

.detail-title-en {
  margin-bottom: 1.4rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
}

.detail-summary {
  margin: 1.8rem 0 2.4rem;
  padding-left: 1.15rem;
  border-left: 3px solid var(--orange);
  font-family: Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.65;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 2.7rem;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.fact-grid > div {
  min-height: 7.2rem;
  padding: 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact-grid dt {
  margin-bottom: 0.7rem;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fact-grid dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.45;
}

.detail-section {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin-bottom: 1.1rem;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.detail-section > p,
.detail-section li {
  color: #39485b;
  font-size: 0.9rem;
  line-height: 1.65;
}

.detail-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  position: relative;
  padding: 0.8rem 0.9rem 0.8rem 2rem;
  background: var(--paper);
  border-radius: 9px;
}

.detail-list li::before {
  content: "";
  position: absolute;
  top: 1.15rem;
  left: 0.85rem;
  width: 0.45rem;
  height: 0.45rem;
  background: var(--orange);
  border-radius: 50%;
}

.evidence-link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.evidence-link strong,
.evidence-link span {
  display: block;
}

.evidence-link strong {
  color: var(--ink);
  font-family: "Yu Mincho", serif;
  line-height: 1.5;
}

.evidence-link span {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.evidence-link::after {
  content: "↗";
  color: var(--orange);
  font-size: 1.15rem;
}

.status-copy {
  color: var(--ink-soft);
  font-style: italic;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  width: min(1220px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  color: var(--ink-soft);
  border-top: 1px solid rgba(23, 35, 58, 0.14);
  font-size: 0.73rem;
  line-height: 1.5;
}

footer p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 4rem 0 3.5rem;
  }

  .hero-meta {
    max-width: 32rem;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
  }

  .filters .section-heading,
  .filters .boundary-note {
    grid-column: 1 / -1;
  }

  .filters .text-button {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .site-header,
  main,
  footer {
    width: min(100% - 1.5rem, 1220px);
  }

  .site-header {
    align-items: flex-start;
  }

  .brand small,
  .dataset-status span:last-child {
    display: none;
  }

  .hero {
    padding-top: 3rem;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.5rem, 11.3vw, 3.1rem);
    line-height: 1;
  }

  .lede {
    max-width: 100%;
  }

  .hero-meta {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
  }

  .hero-meta > div {
    min-height: 7.2rem;
    padding: 1rem;
  }

  .metric {
    margin-bottom: 1.6rem;
    font-size: 2.5rem;
  }

  .metric-small {
    font-size: 0.82rem;
  }

  .metric-label {
    font-size: 0.6rem;
    overflow-wrap: anywhere;
  }

  .workspace {
    gap: 2.4rem;
    padding-top: 2.4rem;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filters .section-heading,
  .filters .boundary-note {
    grid-column: auto;
  }

  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .opportunity-card {
    grid-template-columns: 0.55rem minmax(0, 1fr);
    gap: 1rem;
    padding: 1.15rem 1.1rem 1.15rem 0;
  }

  .card-side {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .arrow {
    margin-top: 0;
  }

  .detail-panel {
    width: 100%;
    padding: 1rem 1rem 3rem;
  }

  .detail-toolbar {
    margin-bottom: 2rem;
  }

  .detail-title-ja {
    font-size: 2rem;
  }

  .fact-grid {
    grid-template-columns: 1fr 1fr;
  }

  footer {
    flex-direction: column;
    gap: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
