/* ==========================================================================
   AsiaLink AI — Legal Site Design System
   Cloudflare Pages · Static HTML · No framework
   ========================================================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #fafbfc;
  --bg-surface: rgba(255, 255, 255, 0.75);
  --bg-card: #ffffff;
  --border-clean: rgba(15, 23, 42, 0.06);
  --border-focus: #0057ff;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-blue: #0057ff;
  --accent-blue-hover: #004ae5;
  --accent-glow: rgba(0, 87, 255, 0.05);
  --font-family: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --header-height: 72px;
  --sticky-offset: 136px;
  --scroll-margin: 120px;
  --container-max: 1280px;
  --content-max: 800px;
  --sidebar-width: 260px;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.8;
  overflow-x: hidden;
}

/* --- Skip link (a11y) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 200;
  padding: 12px 20px;
  background: var(--accent-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
  outline: 2px solid var(--text-main);
  outline-offset: 2px;
}

/* --- Ambient background --- */
.ambient-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.ambient-glow-1 {
  position: absolute;
  top: -10%;
  right: -5%;
  width: 700px;
  height: 700px;
  background: radial-gradient(
    circle,
    rgba(0, 87, 255, 0.04) 0%,
    transparent 70%
  );
  filter: blur(80px);
}

.ambient-glow-2 {
  position: absolute;
  bottom: -5%;
  left: -5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    rgba(14, 165, 233, 0.03) 0%,
    transparent 60%
  );
  filter: blur(60px);
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  width: 100%;
  background: rgba(250, 251, 252, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-clean);
  z-index: 100;
  transition: var(--transition-smooth);
}

.header-inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-logo:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
  border-radius: 6px;
}

.brand-square {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0057ff 0%, #00a3ff 100%);
  box-shadow: 0 2px 8px rgba(0, 87, 255, 0.15);
  flex-shrink: 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-primary {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background-color: var(--accent-blue);
  padding: 8px 18px;
  border-radius: 10px;
  text-decoration: none;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(0, 87, 255, 0.15);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 87, 255, 0.25);
  background-color: var(--accent-blue-hover);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--text-main);
  outline-offset: 2px;
}

/* --- Hero --- */
.hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border-clean);
}

@media (min-width: 768px) {
  .hero {
    padding: 96px 0 64px;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 100px;
  background-color: #fff;
  border: 1px solid var(--border-clean);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  letter-spacing: 0.05em;
  margin-bottom: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.hero-title {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: clamp(16px, 2.5vw, 18px);
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hero-meta {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* --- Main layout: sidebar + content --- */
.layout-wrapper {
  display: flex;
  gap: 32px;
  padding: 48px 0 96px;
  position: relative;
}

@media (min-width: 1024px) {
  .layout-wrapper {
    gap: 64px;
    padding: 64px 0 128px;
  }
}

/* Desktop sticky TOC */
.sidebar-nav {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--sticky-offset);
  height: fit-content;
  display: none;
}

@media (min-width: 1024px) {
  .sidebar-nav {
    display: block;
  }
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-left: 12px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-link {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-smooth);
  border-left: 2px solid transparent;
}

.toc-link:hover {
  color: var(--text-main);
  background-color: rgba(0, 0, 0, 0.02);
}

.toc-link:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.toc-link.active {
  color: var(--accent-blue);
  background-color: var(--accent-glow);
  font-weight: 600;
  border-left-color: var(--accent-blue);
}

/* Mobile horizontal TOC */
.toc-mobile {
  display: block;
  margin-bottom: 32px;
  width: 100%;
}

@media (min-width: 1024px) {
  .toc-mobile {
    display: none;
  }
}

.toc-mobile-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.toc-mobile-scroll .toc-link {
  flex-shrink: 0;
  white-space: nowrap;
  border-left: none;
  border: 1px solid var(--border-clean);
  background: #fff;
}

.toc-mobile-scroll .toc-link.active {
  border-color: var(--accent-blue);
}

/* --- Legal content --- */
.legal-content {
  flex-grow: 1;
  max-width: var(--content-max);
  min-width: 0;
}

.section-block {
  margin-bottom: 56px;
  scroll-margin-top: var(--scroll-margin);
}

@media (min-width: 768px) {
  .section-block {
    margin-bottom: 80px;
  }
}

.section-block:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  padding-bottom: 12px;
}

.section-number {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.section-title {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.paragraph {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: justify;
  hyphens: auto;
}

@media (max-width: 639px) {
  .paragraph {
    text-align: left;
  }
}

/* --- Callouts --- */
.legal-callout {
  background-color: #fff;
  border: 1px solid var(--border-clean);
  border-radius: 16px;
  padding: 20px;
  margin: 24px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.01);
}

@media (min-width: 640px) {
  .legal-callout {
    padding: 24px;
  }
}

.callout-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-blue);
  flex-shrink: 0;
}

.callout-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.callout-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.callout-list--tight {
  gap: 6px;
}

.callout-item {
  font-size: 13.5px;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}

.callout-item::before {
  content: "・";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.legal-callout a {
  color: var(--accent-blue);
  text-decoration: none;
}

.legal-callout a:hover {
  text-decoration: underline;
}

.legal-callout a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Footer --- */
.site-footer {
  background-color: #fff;
  border-top: 1px solid var(--border-clean);
  padding: 48px 0 40px;
  font-size: 13px;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .site-footer {
    padding: 64px 0 48px;
  }
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  margin-bottom: 48px;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-brand h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.footer-tagline {
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.6;
}

.footer-links-column h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.footer-link:hover {
  color: var(--accent-blue);
}

.footer-link:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.footer-bottom {
  border-top: 1px solid var(--border-clean);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
    text-align: left;
  }
}

.copyright {
  color: var(--text-muted);
  font-size: 12px;
}

.footer-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Utility: current page in footer --- */
.footer-link[aria-current="page"] {
  color: var(--accent-blue);
  font-weight: 600;
  pointer-events: none;
}

/* --- Contact page components --- */
.hero-description {
  max-width: 720px;
  color: var(--text-secondary);
  font-size: 15px;
}

.support-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

@media (min-width: 640px) {
  .support-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.support-card {
  background-color: #fff;
  border: 1px solid var(--border-clean);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.01);
}

.support-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.support-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
}

.contact-mail {
  color: var(--accent-blue);
  font-weight: 700;
  text-decoration: none;
}

.contact-mail:hover {
  text-decoration: underline;
}

/* --- Trust center (index) --- */
.btn-secondary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: #fff;
  border: 1px solid var(--border-clean);
  padding: 8px 18px;
  border-radius: 10px;
  text-decoration: none;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn-secondary--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.hero--center {
  text-align: center;
  padding-bottom: 64px;
}

.hero--center .hero-description {
  margin-left: auto;
  margin-right: auto;
  max-width: 620px;
  line-height: 1.8;
}

.hero--center .hero-title {
  font-size: clamp(32px, 6vw, 56px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.trust-section {
  padding: 64px 0;
}

@media (min-width: 768px) {
  .trust-section {
    padding: 96px 0;
  }
}

.trust-section--bordered {
  border-top: 1px solid var(--border-clean);
}

.trust-section--last {
  padding-bottom: 128px;
}

.hub-section-header {
  max-width: 640px;
  margin-bottom: 48px;
}

.hub-section-header h2 {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 12px;
}

.hub-section-header p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .portal-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.portal-card {
  background-color: #fff;
  border: 1px solid var(--border-clean);
  border-radius: 20px;
  padding: 32px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.005);
  transition: var(--transition-smooth);
}

.portal-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 87, 255, 0.15);
  box-shadow: 0 16px 40px rgba(0, 87, 255, 0.03);
}

.portal-card:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
}

.portal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.portal-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.02em;
  transition: var(--transition-smooth);
}

.portal-card:hover .portal-icon {
  background-color: var(--accent-glow);
}

.portal-arrow {
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.portal-card:hover .portal-arrow {
  color: var(--accent-blue);
  transform: translateX(4px);
}

.portal-card-body h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text-main);
}

.portal-card-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.portal-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 768px) {
  .info-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }
}

.info-node h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-node h3::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-blue);
  flex-shrink: 0;
}

.info-node p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

@media (max-width: 639px) {
  .info-node p {
    text-align: left;
  }
}

.support-panel {
  background-color: #fff;
  border: 1px solid var(--border-clean);
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.005);
}

@media (min-width: 768px) {
  .support-panel {
    flex-direction: row;
    align-items: center;
    padding: 48px;
    gap: 32px;
  }
}

.support-panel h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text-main);
}

.support-panel p {
  font-size: 14.5px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0;
}

.support-link-action {
  font-family: "Inter", sans-serif;
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 700;
  color: var(--accent-blue);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.support-link-action:hover {
  border-bottom-color: var(--accent-blue);
  opacity: 0.85;
}

.support-link-action:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
  border-radius: 2px;
}
