/* ===========================================================
   MetaGiga — Web3 Library
   Core stylesheet. Mobile-first, WCAG 2.2 AA, transform/opacity only.
   =========================================================== */

:root {
  /* Orange corporate palette */
  --c-orange-50:  #FFF7ED;
  --c-orange-100: #FFEDD5;
  --c-orange-200: #FED7AA;
  --c-orange-300: #FDBA74;
  --c-orange-400: #FB923C;
  --c-orange-500: #F97316;
  --c-orange-600: #EA580C;
  --c-orange-700: #C2410C;
  --c-orange-800: #9A3412;

  --c-ink:        #1F2937;  /* primary text — 13.6:1 on white */
  --c-ink-soft:   #374151;  /* 10.3:1 on white */
  --c-muted:      #4B5563;  /* 7.5:1 on white — AA for normal text */
  --c-line:       #E5E7EB;
  --c-line-soft:  #F1F0EE;
  --c-bg:         #FFFFFF;
  --c-bg-warm:    #FFFBF6;
  --c-footer:     #2A1A10;  /* deep warm brown for footer */
  --c-footer-2:   #3A2414;

  /* Link color tuned for AA on white: #C2410C ≈ 5.0:1 */
  --c-link:       #C2410C;
  --c-link-hover: #9A3412;

  --font-serif: Georgia, 'Times New Roman', "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-body:  -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
                "Hiragino Sans", "Yu Gothic", "Yu Gothic Medium", Meiryo, "Noto Sans JP",
                Roboto, sans-serif;

  --maxw: 1120px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(31,41,55,.06), 0 1px 3px rgba(31,41,55,.08);
  --shadow-md: 0 4px 12px rgba(154,52,18,.08), 0 2px 4px rgba(31,41,55,.06);
  --shadow-lg: 0 18px 40px rgba(154,52,18,.12), 0 4px 12px rgba(31,41,55,.06);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.85;
  color: var(--c-ink-soft);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--c-link); text-decoration: none; }
a:hover, a:focus-visible { color: var(--c-link-hover); text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--c-orange-600);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--c-ink);
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 .6em;
}

p { margin: 0 0 1.1em; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(18px, 5vw, 32px); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--c-orange-600); color: #fff;
  padding: 12px 18px; z-index: 200; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--c-line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; }
.brand img { width: clamp(180px, 24vw, 220px); height: auto; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border: 1px solid var(--c-line);
  background: #fff; border-radius: 10px; cursor: pointer; color: var(--c-ink);
}
.nav-toggle svg { width: 24px; height: 24px; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(14px, 2.4vw, 30px); }
.primary-nav a {
  display: inline-block; padding: 10px 2px; color: var(--c-ink-soft);
  font-weight: 600; font-size: .98rem; position: relative;
}
.primary-nav a:hover { color: var(--c-orange-700); text-decoration: none; }
.primary-nav a[aria-current="page"] { color: var(--c-orange-700); }
.primary-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 3px;
  background: var(--c-orange-500); border-radius: 3px;
}

@media (max-width: 860px) {
  .primary-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-bottom: 1px solid var(--c-line);
    box-shadow: var(--shadow-md);
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height .28s ease, visibility .28s;
  }
  .primary-nav.open { max-height: 420px; visibility: visible; }
  .primary-nav ul { flex-direction: column; gap: 0; padding: 8px clamp(18px,5vw,32px) 18px; }
  .primary-nav li { border-top: 1px solid var(--c-line-soft); }
  .primary-nav li:first-child { border-top: 0; }
  .primary-nav a { display: block; padding: 14px 0; font-size: 1.05rem; }
  .primary-nav a[aria-current="page"]::after { display: none; }
}
@media (min-width: 861px) {
  .nav-toggle { display: none; }
  .primary-nav { display: block !important; }
}

/* ---------------- Hero ---------------- */
.hero {
  background:
    radial-gradient(1100px 460px at 78% 18%, var(--c-orange-100) 0%, rgba(255,237,213,0) 60%),
    linear-gradient(180deg, var(--c-orange-50) 0%, #ffffff 92%);
  border-bottom: 1px solid var(--c-line-soft);
  overflow: hidden;
}
.hero-grid {
  display: grid; grid-template-columns: 1fr; gap: clamp(28px, 5vw, 56px);
  align-items: center; padding-block: clamp(40px, 7vw, 78px);
}
.hero h1 {
  font-size: clamp(2.1rem, 6.4vw, 3.6rem);
  line-height: 1.18; letter-spacing: -.01em; margin-bottom: .35em;
}
.hero .lead { font-size: clamp(1.02rem, 2.4vw, 1.2rem); color: var(--c-muted); max-width: 38ch; }
.hero-art { position: relative; }
.hero-art .plate {
  width: 100%; max-width: 460px; margin-inline: auto;
  filter: drop-shadow(0 24px 40px rgba(194,65,12,.16));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) {
  .hero-art .plate { animation: none; }
  html { scroll-behavior: auto; }
}
@media (min-width: 861px) {
  .hero-grid { grid-template-columns: 1.05fr .95fr; }
}

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--c-orange-600); color: #fff; font-weight: 700;
  padding: 15px 28px; border-radius: 10px; font-size: 1rem;
  border: 1px solid var(--c-orange-700); cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--c-orange-700); color: #fff; text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }
.btn-ghost {
  background: #fff; color: var(--c-orange-700); border-color: var(--c-orange-300);
}
.btn-ghost:hover { background: var(--c-orange-50); color: var(--c-orange-800); }

/* ---------------- Sections ---------------- */
section { padding-block: clamp(44px, 7vw, 78px); }
.section-warm { background: var(--c-bg-warm); }
.section-head { margin-bottom: clamp(22px, 4vw, 36px); }
.section-head .eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--c-orange-700); margin-bottom: 8px;
  font-family: var(--font-body);
}
.section-head h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0; }
.section-head p { color: var(--c-muted); margin-top: 10px; max-width: 60ch; }

/* Value cards */
.grid-3 { display: grid; gap: clamp(18px, 3vw, 26px); grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 940px) { .grid-3 { grid-template-columns: repeat(4, 1fr); } }

.value-card {
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius-lg);
  padding: 26px 22px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.value-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.value-ic {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: var(--c-orange-100); color: var(--c-orange-700); margin-bottom: 16px;
}
.value-ic svg { width: 28px; height: 28px; }
.value-card h3 { font-size: 1.12rem; margin-bottom: .4em; }
.value-card p { font-size: .94rem; color: var(--c-muted); margin: 0; line-height: 1.7; }

/* Article cards */
.cards { display: grid; gap: clamp(20px, 3vw, 28px); grid-template-columns: 1fr; }
@media (min-width: 680px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards.cards-2 { grid-template-columns: repeat(2, 1fr); } }

.article-card {
  display: flex; flex-direction: column; background: #fff;
  border: 1px solid var(--c-line); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.article-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--c-orange-50); overflow: hidden; }
.article-thumb svg { width: 100%; height: 100%; }
.article-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.article-tag {
  align-self: flex-start; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  color: var(--c-orange-800); background: var(--c-orange-100);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 12px;
}
.article-card h3 { font-size: 1.2rem; line-height: 1.35; margin-bottom: .45em; }
.article-card h3 a { color: var(--c-ink); }
.article-card h3 a:hover { color: var(--c-orange-700); text-decoration: none; }
.article-card .excerpt { font-size: .92rem; color: var(--c-muted); line-height: 1.7; margin-bottom: 18px; flex: 1; }
.article-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .82rem; color: #6B7280; border-top: 1px solid var(--c-line-soft); padding-top: 14px;
}

/* Generic prose (articles & legal pages) */
.page-hero {
  background: linear-gradient(180deg, var(--c-orange-50), #fff);
  border-bottom: 1px solid var(--c-line-soft);
  padding-block: clamp(34px, 6vw, 60px);
}
.breadcrumb { font-size: .82rem; color: var(--c-muted); margin-bottom: 14px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumb li::after { content: "›"; margin-left: 6px; color: var(--c-orange-300); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a { color: var(--c-link); }
.page-hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0; }
.page-hero .dek { color: var(--c-muted); margin-top: 14px; max-width: 65ch; font-size: 1.05rem; }

.layout {
  display: grid; grid-template-columns: 1fr; gap: clamp(28px, 5vw, 52px);
  padding-block: clamp(36px, 6vw, 64px);
}
@media (min-width: 980px) { .layout.has-aside { grid-template-columns: minmax(0,1fr) 280px; } }

.prose { max-width: 72ch; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: clamp(1.4rem, 3.4vw, 1.85rem); margin-top: 1.6em; padding-bottom: .25em; border-bottom: 2px solid var(--c-orange-100); }
.prose h3 { font-size: clamp(1.15rem, 2.6vw, 1.35rem); margin-top: 1.4em; }
.prose p, .prose li { color: var(--c-ink-soft); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: .5em; }
.prose strong { color: var(--c-ink); }
.prose a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.tldr {
  background: var(--c-orange-50); border: 1px solid var(--c-orange-200);
  border-left: 5px solid var(--c-orange-500); border-radius: 10px;
  padding: 18px 22px; margin: 0 0 8px;
}
.tldr p { margin: 0; color: var(--c-ink-soft); }
.tldr .label { display: block; font-weight: 700; color: var(--c-orange-800); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }

.note {
  background: #FFFBEB; border: 1px solid #FDE68A; border-left: 5px solid #F59E0B;
  border-radius: 10px; padding: 16px 20px;
}
.note p:last-child { margin-bottom: 0; }
.note .label { font-weight: 700; color: #92400E; }

table.data {
  width: 100%; border-collapse: collapse; font-size: .92rem;
  border: 1px solid var(--c-line); border-radius: 10px; overflow: hidden;
}
table.data caption { text-align: left; font-size: .85rem; color: var(--c-muted); margin-bottom: 8px; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--c-line); vertical-align: top; }
table.data thead th { background: var(--c-orange-50); color: var(--c-ink); font-weight: 700; }
table.data tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

details.faq {
  border: 1px solid var(--c-line); border-radius: 10px; padding: 4px 18px; background: #fff; margin-bottom: 12px;
}
details.faq + details.faq { margin-top: -2px; }
details.faq summary {
  cursor: pointer; font-weight: 700; color: var(--c-ink); padding: 14px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--c-orange-600); font-size: 1.4rem; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq .faq-body { padding-bottom: 16px; color: var(--c-ink-soft); }
details.faq .faq-body p:last-child { margin-bottom: 0; }

/* Author / aside box */
.aside-box {
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.aside-box h2 { font-size: 1.05rem; font-family: var(--font-body); }
.author-card { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.author-card .avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--c-orange-100); flex: none; }
.author-card .who strong { display: block; color: var(--c-ink); font-size: .98rem; }
.author-card .who span { font-size: .82rem; color: var(--c-muted); }
.toc { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.toc li { margin-bottom: 8px; }
.toc a { color: var(--c-ink-soft); }
.toc a:hover { color: var(--c-orange-700); }

.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; color: var(--c-muted); font-size: .9rem; margin-top: 18px; }
.byline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--c-orange-300); }

/* CTA band */
.cta-band {
  background: linear-gradient(135deg, var(--c-orange-600), var(--c-orange-700));
  color: #fff; border-radius: var(--radius-lg); padding: clamp(28px, 5vw, 48px);
  text-align: center;
}
.cta-band h2 { color: #fff; font-size: clamp(1.5rem, 3.6vw, 2.1rem); }
.cta-band p { color: #FFE9D8; max-width: 56ch; margin-inline: auto; }
.cta-band .btn { background: #fff; color: var(--c-orange-700); border-color: #fff; margin-top: 8px; }
.cta-band .btn:hover { background: var(--c-orange-50); color: var(--c-orange-800); }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--c-footer); color: #E7D9CC; padding-block: clamp(44px, 6vw, 64px) 28px; }
.footer-grid { display: grid; gap: clamp(28px, 4vw, 40px); grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-brand img { width: 210px; margin-bottom: 16px; }
.footer-brand p { color: #C9B6A6; font-size: .92rem; max-width: 40ch; line-height: 1.75; }
.footer-col h3 { color: #fff; font-family: var(--font-body); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 16px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 11px; }
.footer-col a { color: #D8C7B8; font-size: .94rem; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-social { display: flex; gap: 12px; margin-top: 20px; }
.footer-social a {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
  display: grid; place-items: center; color: #E7D9CC;
}
.footer-social a:hover { background: var(--c-orange-600); border-color: var(--c-orange-600); color: #fff; }
.footer-social svg { width: 18px; height: 18px; }
.footer-bottom {
  margin-top: clamp(30px, 5vw, 44px); padding-top: 22px; border-top: 1px solid rgba(255,255,255,.14);
  display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; align-items: center;
  font-size: .85rem; color: #B8A595;
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-bottom a { color: #B8A595; }
.footer-bottom a:hover { color: #fff; }

/* Contact page blocks */
.contact-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .contact-grid { grid-template-columns: repeat(2, 1fr); } }
.contact-card {
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-sm);
}
.contact-card .value-ic { margin-bottom: 14px; }
.contact-card h2 { font-size: 1.15rem; font-family: var(--font-serif); }
.contact-card a.mail { font-size: 1.1rem; font-weight: 700; }

/* 404 */
.notfound { text-align: center; padding-block: clamp(60px, 12vw, 120px); }
.notfound .code { font-family: var(--font-serif); font-size: clamp(4rem, 16vw, 8rem); color: var(--c-orange-500); line-height: 1; margin: 0; }
.notfound h1 { margin-top: 8px; }

hr.rule { border: 0; border-top: 1px solid var(--c-line); margin: clamp(28px,5vw,44px) 0; }
