/* ================================================
   White Out Color Palette — Custom CSS for Hermit-V2
   Kan Sano "White Out" jacket inspired
   ================================================ */

/* === Light Theme (default) === */
:root {
  --bg-base: #F5EDE3;
  --bg-card: #FAF6F0;
  --bg-hover: #EDE4D8;
  --text-primary: #1B2A4A;
  --text-secondary: #5A6B7F;
  --text-tertiary: #8E9AAB;
  --accent: #D4713B;
  --accent-hover: #D4713B;
  --accent-sub: #1B3A6B;
  --border: #DDD4C8;
  --border-light: #EAE3DA;
  --tag-bg: #EDE4D8;
  --tag-text: #1B3A6B;
  --tag-hover-bg: #1B3A6B;
  --tag-hover-text: #F5EDE3;
  --nav-bg: rgba(245, 237, 227, 0.92);
}

/* === Dark Theme === */
[data-theme="dark"] {
  --bg-base: #111D32;
  --bg-card: #182640;
  --bg-hover: #1A2842;
  --text-primary: #F0E8DC;
  --text-secondary: rgba(240, 232, 220, 0.68);
  --text-tertiary: rgba(240, 232, 220, 0.4);
  --accent: #E8955F;
  --accent-hover: #D4713B;
  --accent-sub: #5A8FD4;
  --border: rgba(240, 232, 220, 0.1);
  --border-light: rgba(240, 232, 220, 0.06);
  --tag-bg: rgba(240, 232, 220, 0.08);
  --tag-text: rgba(240, 232, 220, 0.7);
  --tag-hover-bg: #E8955F;
  --tag-hover-text: #111D32;
  --nav-bg: rgba(17, 29, 50, 0.92);
}

[data-theme="dark"],
[data-theme="dark"] html {
  background: var(--bg-base) !important;
}

[data-theme="dark"] body {
  background: var(--bg-base) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .tag {
  color: var(--tag-text) !important;
  background: var(--tag-bg) !important;
  border-color: rgba(240, 232, 220, 0.15) !important;
}

[data-theme="dark"] .tag:hover {
  background: var(--tag-hover-bg) !important;
  color: var(--tag-hover-text) !important;
}

[data-theme="dark"] a {
  color: var(--accent);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .site-main h1,
[data-theme="dark"] .section-header {
  border-bottom-color: var(--border-light) !important;
}

[data-theme="dark"] #site-footer {
  color: var(--text-tertiary) !important;
  border-top-color: var(--border-light) !important;
}

[data-theme="dark"] pre {
  background: var(--bg-card) !important;
  border-color: var(--border-light) !important;
}

[data-theme="dark"] blockquote {
  background: var(--bg-card) !important;
  color: var(--text-secondary) !important;
  border-left-color: var(--accent) !important;
}

[data-theme="dark"] .work-card__icon {
  background: rgba(232, 149, 95, 0.12) !important;
  color: var(--accent) !important;
}

/* ================================================
   Base Overrides
   ================================================ */
body {
  background: var(--bg-base) !important;
  color: var(--text-primary) !important;
  font-family: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  line-height: 1.0;
  letter-spacing: 0.02em;
}

/* ================================================
   Typography
   ================================================ */
h1, h2, h3, h4, h5, h6,
.post-title,
.list-title {
  font-family: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Noto Serif JP', serif;
  letter-spacing: 0.04em;
}

/* === Links === */
a {
  color: var(--accent);
  transition: color 0.2s;
}
a:hover {
  color: var(--accent-hover);
}

/* ================================================
   Layout — Unified content width
   ================================================ */

/* Remove theme's top margin on single pages */
.site-main {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* All main content containers: same max-width */
.site-main,
main {
  max-width: 680px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
}

/* Footer width matches content */
#site-footer {
  max-width: 680px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
}

/* Nav bar width matches content */
.site-nav > div {
  max-width: 680px !important;
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
}

/* ================================================
   List Page Shared Styles
   ================================================ */

/* Section title on list pages (Blog, Notes, Works, Tags) */
.list-page__title {
  font-family: 'Shippori Mincho', serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}

/* Section headers on home page (Blog / Notes) */
.section-header {
  border-bottom: none !important;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.section-header__title {
  font-family: 'Shippori Mincho', serif;
  font-size: 1.1rem !important;
  font-weight: 600;
}
.section-header__more {
  font-size: 0.73rem;
  color: var(--accent);
  text-decoration: none;
  font-style: italic;
}

/* Blog / home post items */
.blog-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-light);
}
.blog-item:last-child {
  border-bottom: none;
}
.blog-item__link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.blog-item__date {
  font-size: 0.74rem;
  color: var(--text-tertiary);
  font-style: italic;
  margin-bottom: 0.2rem;
}
.blog-item__title {
  font-family: 'Shippori Mincho', serif;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 0;
}
.blog-item__excerpt {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-top: 0.05rem;
}
.blog-item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

/* ================================================
   Article Detail Page
   ================================================ */
h1.article-title {
  font-family: 'Shippori Mincho', serif !important;
  font-size: 1.45rem !important;
  font-weight: 700 !important;
  margin-top: 1.5rem !important;
  margin-bottom: 0.6rem !important;
}

/* h2 in article body */
.content h2,
.post-content h2 {
  font-family: 'Shippori Mincho', serif !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  margin-top: 2.5rem !important;
  margin-bottom: 0.7rem !important;
  padding-bottom: 0.25rem !important;
  border-bottom: 2px solid var(--accent) !important;
  display: inline-block !important;
}

/* Article body paragraphs */
.content p,
.post-content p {
  font-size: 0.93rem !important;
  line-height: 1.9 !important;
  letter-spacing: 0.03em !important;
  margin-bottom: 1rem !important;
}

/* Blockquote */
.content blockquote,
.post-content blockquote {
  margin: 1.2rem 0 !important;
  padding: 0.8rem 1.2rem !important;
  font-size: 0.88rem !important;
  line-height: 1.8 !important;
  font-style: italic;
  color: var(--text-secondary);
  background: var(--tag-bg) !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: 0 6px 6px 0 !important;
}

.content blockquote p {
  margin: 0 !important;
}

/* Article meta (date, tags, read time) */
.post-meta,
.post-info {
  font-size: 0.74rem !important;
  color: var(--text-tertiary) !important;
  margin-bottom: 1.5rem !important;
}

.post-meta-block {
  margin-top: 1.2rem;
  margin-bottom: 0.2rem;
}
.post-meta-block p {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin: 0.25rem 0;
  line-height: 1.6;
}
.post-meta-block svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}
.post-meta-block .tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
}
.post-meta-block a {
  color: var(--text-secondary);
}
.post-meta-block a:hover {
  color: var(--accent);
}

/* Back link */
.back-link {
  font-size: 0.74rem;
  color: var(--text-tertiary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
}
.back-link:hover {
  color: var(--accent);
}

/* ================================================
   Tags
   ================================================ */
.tag,
.tags a,
a[href*="/tags/"] {
  font-size: 0.73rem;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.3rem 0.55rem;
  border-radius: 3px;
  text-decoration: none;
  transition: all 0.2s;
}
.tag:hover,
.tags a:hover,
a[href*="/tags/"]:hover {
  background: var(--tag-hover-bg);
  color: var(--tag-hover-text);
}

/* Tag cloud on home */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 2rem;
}

/* ================================================
   Navigation
   ================================================ */
.nav-link:hover {
  color: var(--accent) !important;
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 4px;
}
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-hamburger.is-active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-hamburger.is-active span:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.is-active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile nav */
@media (max-width: 600px) {
  .nav-hamburger {
    display: flex;
  }
  .nav-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--nav-bg, rgba(245, 237, 227, 0.97));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    padding: 0.8rem 1.5rem;
    gap: 0.6rem;
  }
  .nav-menu.is-open {
    display: flex !important;
  }
  .nav-menu li a {
    font-size: 0.85rem !important;
    padding: 0.3rem 0;
  }
}

/* ================================================
   Text wrapping — prevent overflow on narrow screens
   ================================================ */
.content,
.post-content,
.note-item__content {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* ================================================
   Notes (micro posts)
   ================================================ */
.note-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-light);
}
.note-item:last-child {
  border-bottom: none;
}
.note-item__content {
  font-size: 0.88rem;
  line-height: 1.9;
  margin-bottom: 0.3rem;
}
.note-item__footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.note-item__time {
  font-size: 0.73rem;
  color: var(--text-tertiary);
  font-style: italic;
}
.note-item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* ================================================
   Works page
   ================================================ */
.works-list {
  list-style: none;
  padding: 0;
}
.work-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}
.work-card:last-child {
  border-bottom: none;
}
.work-card:hover {
  background: var(--bg-hover);
  margin: 0 -1rem;
  padding: 1rem;
  border-radius: 6px;
}
.work-card__icon {
  width: 52px;
  height: 52px;
  background: var(--tag-bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  font-family: 'Source Serif 4', serif;
}
.work-card__name {
  font-family: 'Shippori Mincho', serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.work-card__desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.work-card__tech {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}
.work-card__tech span {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  background: var(--tag-bg);
  padding: 0.08rem 0.35rem;
  border-radius: 2px;
}
.work-card__arrow {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  transition: color 0.2s;
}
.work-card:hover .work-card__arrow {
  color: var(--accent);
}

/* ================================================
   Tables
   ================================================ */
.content table,
.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1.2rem 0;
}
.content th,
.post-content th {
  font-family: 'Shippori Mincho', serif;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: left;
  padding: 0.5rem 0.8rem;
  border: none;
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.03em;
}
.content td,
.post-content td {
  padding: 0.55rem 0.8rem;
  border: none;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.content tr:last-child td,
.post-content tr:last-child td {
  border-bottom: none;
}
.content tbody tr:hover,
.post-content tbody tr:hover {
  background: var(--bg-hover);
}

/* ================================================
   Code blocks
   ================================================ */
pre {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

/* ================================================
   Footer
   ================================================ */
footer {
  border-top-color: var(--border-light);
  color: var(--text-tertiary);
}
