:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #142126;
  --muted: #617177;
  --line: #d9e3e7;
  --brand: #006f8f;
  --brand-dark: #064b61;
  --accent: #d72f42;
  --soft: #e6f3f6;
  --shadow: 0 16px 45px rgba(10, 36, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

a {
  color: var(--brand-dark);
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: 1.12rem;
  margin-bottom: 0;
}

h2 {
  font-size: clamp(1.45rem, 2.4vw, 2.4rem);
  line-height: 1.25;
  margin-bottom: 0;
}

.search-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  outline: 0;
  background: #fbfdfe;
  color: var(--ink);
}

.search-box input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 111, 143, 0.14);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.section-title button,
.refresh-button,
.hero-actions button,
.presentation-controls button {
  background: var(--soft);
  color: var(--brand-dark);
  padding: 9px 12px;
  font-weight: 800;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-filter,
.tag-pill {
  border-radius: 999px;
  background: #edf4f6;
  color: var(--brand-dark);
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.tag-filter.active {
  background: var(--brand);
  color: #fff;
}

.source-box {
  margin-top: auto;
  padding: 16px;
  border-radius: 8px;
  background: #f7fafb;
  border: 1px solid var(--line);
}

.source-box p {
  margin-bottom: 4px;
  font-weight: 800;
}

.source-box small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.refresh-button {
  width: 100%;
  margin-top: 14px;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.view-switch {
  display: flex;
  gap: 6px;
  background: #dfe9ed;
  padding: 5px;
  border-radius: 8px;
  flex-shrink: 0;
}

.view-button {
  padding: 10px 14px;
  background: transparent;
  color: var(--brand-dark);
  font-weight: 800;
}

.view-button.active {
  background: var(--panel);
  box-shadow: 0 4px 12px rgba(10, 36, 47, 0.1);
}

.hero-panel {
  border-radius: 8px;
  min-height: 180px;
  padding: 26px;
  margin-bottom: 24px;
  color: #fff;
  background:
    linear-gradient(115deg, rgba(4, 64, 82, 0.92), rgba(0, 111, 143, 0.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 500'%3E%3Cg fill='none' stroke='rgba(255,255,255,.28)' stroke-width='2'%3E%3Cpath d='M100 330c180-220 360-220 540 0s360 220 540 0'/%3E%3Cpath d='M0 220c160-90 320-90 480 0s320 90 480 0 160-90 240-45'/%3E%3Ccircle cx='240' cy='150' r='64'/%3E%3Ccircle cx='840' cy='310' r='92'/%3E%3Cpath d='M620 80l110 80-40 130-140 10-70-110z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.hero-panel p {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.hero-panel h3 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 3.1rem);
  line-height: 1.16;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.article-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(10, 36, 47, 0.07);
  display: flex;
  flex-direction: column;
  min-height: 310px;
  text-align: left;
  width: 100%;
}

.article-visual,
.timeline-visual {
  height: 148px;
  background: var(--visual-bg);
  background-position: center;
  background-size: cover;
  position: relative;
  overflow: hidden;
}

.article-visual img,
.presentation-visual img,
.timeline-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.visual-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  width: 72px;
  height: 72px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px 8px rgba(7, 26, 34, 0.36);
}

.visual-label {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 1;
  max-width: calc(100% - 32px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-dark);
  padding: 7px 11px;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
}

.has-real-image .visual-label,
.presentation-visual.has-real-image .visual-label {
  background: rgba(7, 26, 34, 0.72);
  color: #fff;
}

.has-real-image .visual-icon,
.presentation-visual.has-real-image .visual-icon {
  display: none;
}

.article-visual::before,
.presentation-visual::before,
.timeline-visual::before {
  content: "";
  position: absolute;
  inset: 18%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 40%;
  transform: rotate(var(--visual-rotate));
}

.has-real-image .article-visual::before,
.presentation-visual.has-real-image::before,
.timeline-visual.has-real-image::before,
.detail-hero.has-real-image::before {
  content: none;
}

.article-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.article-date {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.article-card h3 {
  margin-bottom: 14px;
  font-size: 1.05rem;
  line-height: 1.5;
}

.article-excerpt {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 14px;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.presentation-card {
  min-height: 560px;
  display: grid;
  grid-template-columns: 48% 52%;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
}

.presentation-visual {
  position: relative;
  min-height: 420px;
  background: var(--visual-bg);
  background-position: center;
  background-size: cover;
}

.presentation-copy {
  padding: clamp(28px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.presentation-copy h3 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.18;
  margin-bottom: 24px;
}

.presentation-copy p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.presentation-controls {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 30px;
}

.presentation-controls span {
  color: var(--muted);
  font-weight: 800;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 120px 148px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  width: 100%;
  color: inherit;
  text-align: left;
}

.timeline-visual {
  height: 92px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.timeline-visual .visual-label {
  left: 10px;
  bottom: 8px;
  max-width: calc(100% - 20px);
  padding: 5px 8px;
  font-size: 0.72rem;
}

.timeline-visual .visual-icon {
  width: 48px;
  height: 48px;
  font-size: 0.9rem;
}

.timeline-date {
  color: var(--brand);
  font-weight: 900;
}

.timeline-item h3 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.tag-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.tag-card {
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 18px;
  text-align: left;
}

.tag-card strong {
  display: block;
  font-size: 1.2rem;
  color: var(--brand-dark);
}

.tag-card span {
  display: block;
  color: var(--muted);
}

.tag-card small {
  display: block;
  margin-top: 10px;
  color: var(--brand);
  font-weight: 800;
}

.article-card:hover,
.timeline-item:hover,
.tag-card:hover,
.presentation-card:hover {
  border-color: rgba(0, 111, 143, 0.45);
  box-shadow: 0 12px 30px rgba(10, 36, 47, 0.12);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 38px;
  background: var(--panel);
  text-align: center;
  color: var(--muted);
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(7, 26, 34, 0.62);
  padding: 28px;
  overflow: auto;
}

.detail-overlay[hidden] {
  display: none;
}

.detail-panel {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
}

.detail-hero {
  min-height: 320px;
  background: var(--visual-bg);
  background-position: center;
  background-size: cover;
}

.detail-body {
  padding: clamp(24px, 4vw, 46px);
}

.detail-body h2 {
  margin: 0 0 18px;
}

.detail-lead {
  margin: 20px 0;
  color: var(--brand-dark);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.7;
}

.detail-sections {
  display: grid;
  gap: 22px;
  margin-top: 26px;
}

.detail-section h3 {
  margin-bottom: 8px;
  color: var(--brand-dark);
}

.detail-section p {
  color: var(--ink);
  line-height: 1.9;
}

.detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 28px;
}

.detail-images img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.detail-source {
  display: inline-flex;
  margin-top: 26px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar,
  .hero-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .view-switch {
    overflow-x: auto;
  }

  .presentation-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .timeline-visual {
    height: 150px;
  }
}
