/* ============================================
   Y's Talk — Light Editorial CSS
   Warm, modern, archive-friendly
   ============================================ */

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

:root {
  --bg:        #f7f4ef;
  --bg2:       #eeeae3;
  --fg:        #1a1714;
  --fg-muted:  #6b6460;
  --gold:      oklch(58% 0.13 68);
  --gold-dim:  oklch(72% 0.10 68);
  --teal:      oklch(48% 0.09 195);
  --line:      rgba(26,23,20,.12);
  --nav-bg:    #1a1714;
  --nav-fg:    #f0ebe2;
  --serif-en:  'Cormorant Garamond', Georgia, serif;
  --serif-jp:  'Noto Serif JP', serif;
  --sans:      'Space Grotesk', sans-serif;
  --max-w:     900px;
  --radius:    4px;
  --shadow:    0 2px 12px rgba(0,0,0,.07);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--serif-jp);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.95;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── HEADER / NAV ── */
.site-header {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.site-header .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-logo {
  font-family: var(--serif-en);
  font-size: 1.3rem;
  font-style: italic;
  font-weight: 600;
  color: var(--nav-fg);
  text-decoration: none;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--gold-dim); }

.main-nav {
  display: flex;
  gap: .2rem;
  flex-wrap: wrap;
}
.main-nav a {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(240,235,226,.65);
  text-decoration: none;
  padding: .3rem .75rem;
  border-radius: var(--radius);
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.main-nav a:hover {
  color: var(--nav-fg);
  background: rgba(255,255,255,.08);
}
.main-nav a.active {
  color: var(--gold-dim);
}

/* ── MAIN ── */
main {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding: 2.5rem 1.5rem 4rem;
}

/* ── FOOTER ── */
.site-footer {
  background: var(--nav-bg);
  color: rgba(240,235,226,.45);
  text-align: center;
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .06em;
  padding: 1.5rem;
  margin-top: auto;
}
.site-footer a {
  color: var(--gold-dim);
  text-decoration: none;
}
.site-footer a:hover { color: var(--nav-fg); }

/* ── ARCHIVE NOTICE ── */
.archive-notice {
  background: oklch(97% 0.02 80);
  border-left: 3px solid var(--gold);
  padding: .6rem 1rem;
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--fg-muted);
  margin-bottom: 2rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── PAGE TITLE AREA ── */
.page-title {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.page-title h1 {
  font-family: var(--serif-en);
  font-size: 2.4rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
  margin: 0;
}
.page-title .sub {
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: .4rem;
  display: block;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif-jp);
  line-height: 1.5;
  margin-top: 1.8em;
  margin-bottom: .6em;
  color: var(--fg);
}
h1 { font-size: 1.7rem; font-weight: 700; }
h2 {
  font-size: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: .4rem;
}
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }

p { margin-bottom: 1em; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--teal); text-decoration: underline; }

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

blockquote {
  border-left: 3px solid var(--gold-dim);
  padding: .6rem 1.2rem;
  margin: 1.2rem 0 1.2rem 0;
  color: var(--fg-muted);
  font-style: italic;
}

ul, ol { padding-left: 1.5em; margin-bottom: 1em; }
li { margin-bottom: .3em; }

/* ── SECTION BAR (replaces old bgcolor="#009999" headers) ── */
.section-bar,
table[bgcolor="#009999"] td,
table[bgcolor="#3e81b7"] td,
[style*="background-color: rgb(0, 153, 153)"],
[style*="background-color: rgb(62, 129, 183)"] {
  background: var(--bg2) !important;
  border-left: 3px solid var(--gold);
  color: var(--fg) !important;
  padding: .5rem .9rem;
  font-weight: 600;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .9rem;
}

/* ── IMAGES ── */
img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  border-radius: var(--radius);
}
p img, td img, li img, a img {
  display: inline;
  border-radius: 3px;
  vertical-align: middle;
}

/* ── TABLES ── */
table {
  border-collapse: collapse;
  max-width: 100%;
  width: 100%;
}
td, th {
  max-width: 100%;
  word-break: break-word;
  vertical-align: top;
}

/* scrollable wrapper */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

/* data tables */
table[border="1"], table.data-table {
  font-size: .9rem;
  border: 1px solid var(--line);
}
table[border="1"] th,
table[border="1"] td,
table.data-table th,
table.data-table td {
  border: 1px solid var(--line);
  padding: .45rem .65rem;
}
table[border="1"] tr:nth-child(even) {
  background: var(--bg2);
}

/* layout tables: neutralise bgcolor */
table[bgcolor] { background: transparent !important; }
td[bgcolor="#009999"], td[bgcolor="#3e81b7"] {
  background: var(--bg2) !important;
  color: var(--fg) !important;
}
td[bgcolor="#ffcccc"], td[bgcolor="pink"],
[style*="background-color: rgb(255, 204, 204)"] {
  background: oklch(96% 0.02 60) !important;
}

/* ── CARDS ── */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

/* ── TALK LIST ── */
.talk-list { list-style: none; padding: 0; }
.talk-list li {
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: .6rem;
}
.talk-list li:last-child { border-bottom: none; }
.talk-num {
  font-family: var(--sans);
  font-size: .68rem;
  background: var(--fg);
  color: #fff;
  padding: .1rem .45rem;
  border-radius: 3px;
  white-space: nowrap;
}
.talk-date {
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

/* ── PHOTO GRID ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .8rem;
  margin: 1.2rem 0;
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.photo-grid img:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
}

/* ── INLINE COLOR OVERRIDES (legacy font tags) ── */
font[color="#ff6666"],
font[color="#FF6666"],
[style*="color: rgb(255, 102, 102)"] { color: var(--gold) !important; }

font[color="#009999"],
font[color="#0099cc"],
[style*="color: rgb(0, 153, 153)"] { color: var(--teal) !important; }

font[color="#ffffff"],
font[color="#FFFFFF"],
[style*="color: rgb(255, 255, 255)"] { color: var(--fg) !important; }

font[color="#999999"],
[style*="color: rgb(153, 153, 153)"] { color: var(--fg-muted) !important; }

/* ── PREFORMATTED ── */
pre, code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .87em;
  background: var(--bg2);
  border-radius: 3px;
}
pre { padding: 1rem; overflow-x: auto; }
code { padding: .1em .35em; }

/* ── LEGACY ── */
center { text-align: center; }
main { overflow-x: hidden; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .site-header .inner { gap: .6rem; }
  .site-logo { font-size: 1.1rem; }
  .main-nav a { font-size: .65rem; padding: .25rem .5rem; }
  main { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.1rem; }

  /* stack layout tables on mobile */
  table[border="0"] td,
  table[border="0"] th,
  table:not([border]) td,
  table:not([border]) th {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  table[border="1"] {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table[border="1"] td,
  table[border="1"] th {
    display: table-cell !important;
    width: auto !important;
  }
}
