@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;500;700&family=Noto+Serif:ital,wght@0,400;0,700;1,400&family=Noto+Sans+JP:wght@300;400;500&family=Noto+Sans:wght@300;400&display=swap');

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

:root {
  --ink:       #1a1a14;
  --ink-mid:   #3d3d30;
  --ink-soft:  #7a7a68;
  --rice:      #faf8f0;
  --rice-dark: #f0ece0;
  --steam:     #e8e2d0;
  --green:     #3a5a2e;
  --green-mid: #5a8048;
  --green-lt:  #d4e8cc;
  --accent:    #8b4513;
  --accent-lt: #f0e0d0;
  --line:      #c8c0a8;
  --serif-ja:  'Noto Serif JP', 'Yu Mincho', serif;
  --serif-en:  'Noto Serif', Georgia, serif;
  --sans-ja:   'Noto Sans JP', sans-serif;
  --sans-en:   'Noto Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--rice);
  color: var(--ink);
  font-family: var(--serif-ja);
  font-size: 15px;
  line-height: 1.9;
  min-height: 100vh;
}

/* ── GRAIN OVERLAY ── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0; opacity: 0.6;
}

/* ── LAYOUT ── */
.site-header {
  background: var(--green);
  color: #fff;
  padding: 0 2rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

.header-inner {
  max-width: 820px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}

.site-title {
  font-family: var(--serif-ja);
  font-size: 1rem; font-weight: 700;
  letter-spacing: .08em;
  color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: .5rem;
}
.site-title .icon { font-size: 1.2rem; }

nav { display: flex; gap: .2rem; }
nav a {
  font-family: var(--sans-ja); font-size: .75rem; font-weight: 400;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: .35rem .75rem; border-radius: 3px;
  transition: background .15s, color .15s;
  letter-spacing: .04em;
}
nav a:hover, nav a.active { background: rgba(255,255,255,.15); color: #fff; }

/* ── HERO (index only) ── */
.hero {
  background: linear-gradient(160deg, var(--green) 0%, #2a4220 100%);
  color: #fff;
  padding: 5rem 2rem 4rem;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::after {
  content: '🍚';
  position: absolute; font-size: 14rem; opacity: .06;
  bottom: -2rem; right: -2rem; pointer-events: none;
  line-height: 1;
}
.hero-app { font-family: var(--sans-ja); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; opacity: .7; margin-bottom: 1rem; }
.hero h1 { font-family: var(--serif-ja); font-size: 2rem; font-weight: 700; line-height: 1.4; margin-bottom: 1.2rem; }
.hero p { font-family: var(--sans-ja); font-size: .9rem; opacity: .85; max-width: 480px; margin: 0 auto; line-height: 1.7; }

.hero-cards {
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
  margin-top: 3rem;
}
.hero-card {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; padding: 1.5rem 2rem;
  text-decoration: none; color: #fff;
  transition: background .2s, transform .2s;
  min-width: 200px;
}
.hero-card:hover { background: rgba(255,255,255,.18); transform: translateY(-2px); }
.hero-card .label { font-family: var(--sans-ja); font-size: .7rem; opacity: .7; letter-spacing: .1em; display: block; margin-bottom: .4rem; }
.hero-card .title-ja { font-family: var(--serif-ja); font-size: 1.1rem; font-weight: 700; display: block; }
.hero-card .title-en { font-family: var(--serif-en); font-size: .78rem; opacity: .7; display: block; margin-top: .2rem; }

/* ── DOCUMENT LAYOUT ── */
.doc-wrap { max-width: 820px; margin: 0 auto; padding: 3rem 2rem 6rem; position: relative; z-index: 1; }

.doc-meta {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.doc-badge {
  background: var(--green); color: #fff;
  font-family: var(--sans-en); font-size: .7rem;
  padding: .25rem .75rem; border-radius: 2px; letter-spacing: .1em;
}
.doc-date { font-family: var(--sans-en); font-size: .8rem; color: var(--ink-soft); }
.doc-lang-switch {
  margin-left: auto;
  display: flex; gap: .5rem;
}
.lang-btn {
  font-family: var(--sans-en); font-size: .72rem;
  background: none; border: 1px solid var(--line);
  color: var(--ink-mid); padding: .2rem .6rem; border-radius: 2px;
  cursor: pointer; transition: all .15s;
}
.lang-btn:hover, .lang-btn.active { background: var(--green); border-color: var(--green); color: #fff; }

/* ── TOC ── */
.toc {
  background: var(--rice-dark);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  padding: 1.5rem 2rem; margin-bottom: 3rem;
  border-radius: 0 4px 4px 0;
}
.toc-title { font-family: var(--sans-ja); font-size: .75rem; letter-spacing: .15em; color: var(--ink-soft); margin-bottom: .8rem; font-weight: 500; }
.toc ol { padding-left: 1.2rem; }
.toc li { margin: .25rem 0; }
.toc a { font-family: var(--sans-ja); font-size: .82rem; color: var(--green-mid); text-decoration: none; transition: color .15s; }
.toc a:hover { color: var(--green); }

/* ── ARTICLE CONTENT ── */
.article { position: relative; }

.art-section { margin-bottom: 3.5rem; }

.art-h1 {
  font-family: var(--serif-ja);
  font-size: 1.05rem; font-weight: 700;
  color: var(--green);
  border-bottom: 1px solid var(--green-lt);
  padding-bottom: .6rem; margin-bottom: 1.2rem;
  letter-spacing: .04em;
  display: flex; align-items: baseline; gap: .6rem;
}
.art-h1 .num {
  font-family: var(--sans-en); font-size: .7rem; font-weight: 400;
  background: var(--green); color: #fff;
  padding: .1rem .45rem; border-radius: 2px; letter-spacing: .05em;
  flex-shrink: 0;
}

.art-h2 {
  font-family: var(--serif-ja); font-size: .95rem; font-weight: 700;
  color: var(--ink-mid); margin: 1.8rem 0 .8rem;
  padding-left: .8rem;
  border-left: 3px solid var(--steam);
}

.bilingual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
@media (max-width: 640px) { .bilingual { grid-template-columns: 1fr; } }

.lang-ja, .lang-en {
  padding: 1rem 1.2rem;
  border-radius: 4px;
}
.lang-ja { background: rgba(58,90,46,.04); border: 1px solid rgba(58,90,46,.1); }
.lang-en { background: rgba(139,69,19,.04); border: 1px solid rgba(139,69,19,.1); }

.lang-label {
  font-family: var(--sans-en); font-size: .65rem; letter-spacing: .15em;
  font-weight: 500; margin-bottom: .5rem; display: block;
}
.lang-ja .lang-label { color: var(--green-mid); }
.lang-en .lang-label { color: var(--accent); }

.lang-ja p, .lang-en p {
  font-size: .88rem; line-height: 1.85;
}
.lang-ja p { font-family: var(--serif-ja); }
.lang-en p { font-family: var(--serif-en); }

ul.bi-list { list-style: none; padding: 0; margin: .5rem 0; }
ul.bi-list li {
  font-size: .85rem; line-height: 1.7;
  padding: .3rem 0 .3rem 1.2rem;
  position: relative;
  border-bottom: 1px dashed var(--line);
}
ul.bi-list li:last-child { border-bottom: none; }
ul.bi-list li::before {
  content: '▸'; position: absolute; left: 0;
  color: var(--green-mid); font-size: .7rem; top: .45rem;
}
.lang-ja ul.bi-list li { font-family: var(--serif-ja); }
.lang-en ul.bi-list li { font-family: var(--serif-en); }

.note-box {
  background: var(--accent-lt);
  border-left: 3px solid var(--accent);
  padding: .9rem 1.2rem; margin: 1rem 0;
  border-radius: 0 4px 4px 0;
  font-size: .82rem; line-height: 1.7;
}
.note-box a { color: var(--accent); }

.gdpr-box, .ccpa-box {
  border: 1px solid var(--line);
  border-radius: 4px; padding: 1rem 1.2rem; margin: .8rem 0;
  background: var(--rice-dark);
}
.gdpr-box h4, .ccpa-box h4 {
  font-family: var(--sans-ja); font-size: .78rem; font-weight: 500;
  color: var(--green); margin-bottom: .5rem; letter-spacing: .05em;
}
.gdpr-box p, .ccpa-box p { font-size: .82rem; line-height: 1.7; font-family: var(--sans-ja); }
.gdpr-box p + p, .ccpa-box p + p { margin-top: .4rem; font-family: var(--sans-en); font-size: .8rem; color: var(--ink-mid); }

table.contact-table {
  width: 100%; border-collapse: collapse; margin-top: 1rem;
  font-family: var(--sans-ja); font-size: .85rem;
}
table.contact-table th, table.contact-table td {
  padding: .7rem 1rem; border: 1px solid var(--line); text-align: left;
}
table.contact-table th { background: var(--rice-dark); font-weight: 500; color: var(--ink-mid); }
table.contact-table td { color: var(--ink-soft); font-style: italic; }

/* ── SINGLE VIEW MODE (lang switch) ── */
body.show-ja .lang-en { display: none; }
body.show-en .lang-ja { display: none; }
body.show-ja .bilingual, body.show-en .bilingual { grid-template-columns: 1fr; }

/* ── FOOTER ── */
.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,.5);
  text-align: center; padding: 2rem;
  font-family: var(--sans-en); font-size: .75rem; line-height: 1.8;
  position: relative; z-index: 1;
}
.site-footer a { color: rgba(255,255,255,.6); text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* ── BACK TO TOP ── */
.back-top {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--green); color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
}
.back-top.visible { opacity: 1; pointer-events: auto; }
.back-top:hover { transform: translateY(-3px); }

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .doc-wrap { padding: 2rem 1.2rem 5rem; }
  .art-h1 { font-size: .95rem; }
}
