:root {
  --bg: #F7F1E3;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --line: #e6e7e2;
  --accent: #317574;
  --accent-ink: #ffffff;
  --accent-ghost: rgba(49, 117, 116, 0.12);
  --shadow: none;
  --card: #F9F5E9;
  --noise-opacity: 0.04;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Zen Kaku Gothic New", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

main {
  flex: 1;
  padding-bottom: 8px;
}


.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}
.brand-name {
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 18px;
  background: linear-gradient(90deg, var(--text) 0%, var(--accent) 65%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-name::after {
  content: "";
  display: block;
  height: 2px;
  width: 36px;
  background: var(--accent);
  border-radius: 999px;
  margin-top: 2px;
  opacity: 0.6;
}
.brand-logo {
  height: 28px;
  width: auto;
}
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
.menu-toggle:hover {
  background: #f5f5f2;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.nav-links a {
  color: inherit;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background-color .2s ease, color .2s ease, text-decoration-color .2s ease;
}
.nav-links a:hover {
  background: transparent;
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
  transition: background-color .2s ease, box-shadow .2s ease, filter .2s ease, transform .2s ease, border-color .2s ease, color .2s ease;
}
.btn:hover {
  filter: brightness(0.99);
}
.btn:active {
  transform: translateY(1px);
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn.ghost:hover {
  background: #f5f5f2;
}
.btn.small {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
}

/* Disabled state */
.btn.is-disabled,
.btn[aria-disabled="true"] {
  background: var(--line);
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
  transform: none;
}
.btn.is-disabled:hover,
.btn[aria-disabled="true"]:hover {
  background: var(--line);
}

/* Hero */
.hero {
  position: relative;
  padding: 40px 0 24px;
  background: linear-gradient(180deg, rgba(49,117,116,0.06), rgba(49,117,116,0) 50%), var(--bg);
}
.hero-title {
  font-size: clamp(28px, 7vw, 48px);
  line-height: 1.15;
  letter-spacing: 0.2px;
  margin: 0 0 10px 0;
}
.hero-subtitle {
  font-size: clamp(15px, 3.6vw, 18px);
  color: var(--muted);
  margin: 0 0 16px 0;
}
.hero-cta {
  display: flex;
  gap: 12px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Sections */
.section {
  padding: 20px 0 16px;
}
.section:last-child {
  padding-bottom: 8px;
}
.section.muted {
  background: var(--bg);
}
.section-title {
  font-size: clamp(18px, 4vw, 22px);
  margin: 0 0 10px 0;
}

.section-intro {
  margin: 0 0 24px 0;
}
.super-title {
  margin: 0 0 6px 0;
  font-size: clamp(18px, 4vw, 22px);
  line-height: 1.15;
  letter-spacing: 0.4px;
  background: linear-gradient(90deg, var(--text) 0%, var(--accent) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-text {
  margin: 0;
  color: var(--muted);
}
.intro-list {
  margin: 8px 0 0 0;
  padding-left: 18px;
}
.intro-list li {
  margin: 4px 0;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
/* Subtle noise overlay for cards */
.card,
.index-card {
  position: relative;
  overflow: hidden;
}
.card::after,
.index-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/><feComponentTransfer><feFuncA type='linear' slope='1'/></feComponentTransfer></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 120px 120px;
  background-repeat: repeat;
  opacity: var(--noise-opacity);
  mix-blend-mode: multiply;
}
@media (hover: hover) {
  .card:hover {
    border-color: rgba(49,117,116,0.2);
  }
}
.card-title {
  margin: 0 0 6px 0;
  font-size: 16px;
}
.card-text {
  margin: 0;
  color: var(--muted);
}

.card-list {
  margin: 10px 0 0 0;
  padding-left: 18px;
  color: var(--text);
}
.card-list li {
  margin: 4px 0;
}
.card-list code {
  background: rgba(26,26,26,0.06);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

/* Indices */
.index-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}
.index-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.index-name {
  font-weight: 600;
}
.index-tag {
  font-size: 12px;
  color: var(--muted);
  background: rgba(49,117,116,0.06);
  border: 1px solid rgba(49,117,116,0.18);
  padding: 2px 8px;
  border-radius: 999px;
}
.index-value {
  font-size: 24px;
  letter-spacing: 0.5px;
}
.note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

/* Footer */
.site-footer {
  border-top: none;
  padding: 16px 0;
  background: var(--bg);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.social-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(26,26,26,0.2);
  padding-bottom: 1px;
}
.social-link:hover {
  border-bottom-color: rgba(26,26,26,0.4);
  text-decoration: none;
}

/* Focus: visible and refined */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.menu-toggle:focus-visible,
.nav-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Text selection color aligned with accent */
::selection {
  background: rgba(49,117,116,0.14);
  color: var(--text);
}

/* Responsive */
@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .index-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

@supports (padding: max(0px)) {
  .nav {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .site-footer .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  /* Move safe bottom space to footer to keep tight gap above it */
  main {
    padding-bottom: 8px;
  }
  .site-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}
