/* ── NOTE APP DESIGN SYSTEM ── */
:root {
  /* Core Colors */
  --bg: #f8f9fa;
  --surface: #ffffff;
  --ink: #1e293b;
  --ink2: #475569;
  --ink3: #94a3b8;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  
  /* Sticky Note Palette */
  --tag-yellow: #fef9c3;
  --tag-blue: #e0f2fe;
  --tag-purple: #f3e8ff;
  --tag-green: #dcfce7;
  --tag-orange: #ffedd5;
  --tag-pink: #fce7f3;
  --sticky-yellow: #fff9c4;
  --sticky-blue: #e1f5fe;
  --sticky-pink: #fce4ec;
  --sticky-green: #f1f8e9;
  
  /* Category Mapping */
  --cat-planning: #facc15;
  --cat-ia: #0ea5e9;
  --cat-production: #7c3aed;
  --cat-failure: #ef4444;
  --cat-operation: #22c55e;
  --cat-promotion: #fb923c;
  --cat-writing: #ec4899;
  --cat-tools: #2563eb;
  --cat-recruit: #f43f5e;
  
  /* UI Constants */
  --header-h: 64px;
  --sticky-shadow: 2px 4px 8px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --modal-z: 10000;
  --font-sans: "Inter", "Noto Sans JP", sans-serif;
  --font-hand: "Inter", "Noto Sans JP", sans-serif;
  --syne: "Inter", "Noto Sans JP", sans-serif;
  
  /* Search & Input */
  --border-light: rgba(0, 0, 0, 0.08);
  --bg-input: rgba(0, 0, 0, 0.03);

  /* Typography Scale */
  --mono: "Inter", "Noto Sans JP", sans-serif;
  --font-ui-sm: 11px;
  --font-ui-md: 13px;
  --font-ui-lg: 15px;

  /* Layout & Spacing */
  --app-header-height: 56px;
  --app-header-gap: var(--gap-lg);
  --card-section-gap: 24px;
  --ui-gap: var(--gap-lg);
  --gap-xs: 4px;
  --gap-sm: 6px;
  --gap-md: 8px;
  --gap-lg: 12px;
  --gap-xl: 16px;
  --gap-2xl: 24px;

  /* Controls */
  --ui-control-h-sm: 28px;
  --ui-radius-sm: 6px;

  /* Border Radius Scale */
  --radius-full: 999px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px; --bg2: #f1f5f9; --bg3: #e2e8f0; --border: #e2e8f0; --border2: #cbd5e1; --ink1: #0f172a;
}

/* ── RESET & BASE ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── UTILITIES ── */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-column { display: flex; flex-direction: column; }
.flex-wrap { display: flex; flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }


/* ── UNIFIED DESIGN SYSTEM ── */
.sticky-shadow { box-shadow: var(--sticky-shadow); }

.paper-clip {
  position: absolute;
  top: -18px;
  right: 30px;
  width: 14px;
  height: 44px;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  background: transparent;
  z-index: 50;
  transform: rotate(8deg);
  box-shadow: 1px 1px 1px rgba(0,0,0,0.05);
}

.paper-clip::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 2.5px;
  width: 6px;
  height: 28px;
  border: 1.5px solid #cbd5e1;
  border-top: none;
  border-radius: 0 0 10px 10px;
}

.paper-clip::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 1px;
  width: 9px;
  height: 18px;
  border: 1.5px solid #cbd5e1;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

.sticky-note {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  position: relative;
}
.sticky-note:hover {
  transform: scale(1.02) rotate(0deg) !important;
  z-index: 20;
  box-shadow: 4px 8px 16px rgba(0, 0, 0, 0.08);
}

/* ── ARTICLE CONTENT ── */
.article-content-card {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg2) 94%, #fff 6%), var(--bg2)),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 31px,
      color-mix(in srgb, var(--accent) 7%, transparent) 32px
    );
  padding: 24px 24px 24px 48px; /* Added left padding for holes */
  margin-bottom: 24px;
  box-shadow:
    0 18px 42px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.05);
}

.article-view .article-content-card::after {
  content: '';
  position: absolute;
  left: 14px;
  top: 26px;
  bottom: 18px;
  width: 14px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 8px, rgba(255, 255, 255, 0.9) 0 3px, transparent 3.2px) 0 0 / 100% 30px,
    rgba(140, 146, 156, 0.34);
  opacity: 0.7;
  pointer-events: none;
}

.article-content-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 8px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 30%, transparent));
  opacity: .7;
  pointer-events: none;
}

.article-header {
  position: relative;
  margin-bottom: 24px;
  padding: 6px 4px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
}

.article-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* ── MODAL SYSTEM ── */

/* ===== Integrated from site2.css ===== */

/* index2.html dedicated override stylesheet
   Base styles are loaded from css/site.css.
   Add only delta rules for index2 here. */

/* Utility Classes */
.hidden {
  display: none;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* recent-row: カテゴリバッジ非表示（青い点の原因） */
.recent-row .article-badge-wrap {
  display: none !important;
}

/* Base Sticky Note Style & Rotations */
.sticky-note, 
.home-category-note, 
.article-row, 
.home-track-card {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sticky-note:nth-child(4n+1), .home-category-note:nth-child(4n+1), .article-row:nth-child(4n+1), .home-track-card:nth-child(4n+1) { transform: rotate(-0.8deg); }
.sticky-note:nth-child(4n+2), .home-category-note:nth-child(4n+2), .article-row:nth-child(4n+2), .home-track-card:nth-child(4n+2) { transform: rotate(1.2deg); }
.sticky-note:nth-child(4n+3), .home-category-note:nth-child(4n+3), .article-row:nth-child(4n+3), .home-track-card:nth-child(4n+3) { transform: rotate(-1.5deg); }
.sticky-note:nth-child(4n+4), .home-category-note:nth-child(4n+4), .article-row:nth-child(4n+4), .home-track-card:nth-child(4n+4) { transform: rotate(0.8deg); }

/* Modal Sizes */
.modal-chat-box {
  width: min(500px, 96vw) !important;
}

.modal-large-box {
  width: min(1200px, 98vw) !important;
  max-height: 96vh !important;
  display: flex !important;
  flex-direction: column !important;
  transform: rotate(0deg) !important;
  border-radius: 20px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

/* Glassmorphism Header */
body.index2-preview .header {
  background: #ffffff !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body[data-theme="dark"].index2-preview .header {
  background: rgba(15, 23, 42, 0.8) !important;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* ===== Global Section Visibility ===== */
/* Only hide top-level view sections, not nested sections in homeView */
section.article-view,
section.category-view,
section.tools-view,
section.requests-view,
section.glossary-view,
section.editors-view {
  display: none;
}

section.visible {
  display: block !important;
}

/* ===== index2: Category Top Styling ===== */
#categoryView .category-top-hero-card {
  transform: rotate(-0.35deg);
}

#categoryView .category-top-nav-card {
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.9), rgba(255, 255, 255, 1));
}

#categoryView .category-top-list-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

/* Unify View Containers (1200px Max Width) */
#homeView,
#articleView,
#categoryView,
#toolsView,
#requestsView,
#commentsView,
#editorsView,
#glossaryView {
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Vertical Spacing for Views */
#homeView,
#articleView,
#categoryView,
#toolsView,
#requestsView,
#commentsView,
#editorsView,
#glossaryView {
  padding-top: 24px !important;
  padding-bottom: 60px !important;
}


/* shared category card grid */
:is(#homeCategoryNavList, #categoryNavList, #glossaryCategoryNavList, #dictionaryTopCategoryNavList, #appendixTopCategoryNavList) .category-home-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 900px) {
  :is(#homeCategoryNavList, #categoryNavList, #glossaryCategoryNavList, #dictionaryTopCategoryNavList, #appendixTopCategoryNavList) .category-home-note-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Sticky Note Style Category Cards */
.home-category-note {
  aspect-ratio: auto !important;
  height: 64px !important;
  min-height: 0 !important;
  padding: 8px 8px 4px !important;
  position: relative;
  border-radius: 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.home-category-note .home-category-note-tape {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 14px;
  border-radius: 2px;
  background: rgba(20, 28, 41, 0.1);
  border: 1px solid rgba(20, 28, 41, 0.05);
  pointer-events: none;
  z-index: 10;
}

.home-category-note .material-symbols-outlined {
  font-size: 20px;
  margin-bottom: 2px;
  opacity: 0.9;
}

.home-category-note .home-category-note-text {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  width: 100%;
}

/* generalized rotations for sticky notes */
.home-category-note:nth-child(4n + 1) { transform: rotate(-0.5deg); }
.home-category-note:nth-child(4n + 2) { transform: rotate(0.4deg); }
.home-category-note:nth-child(4n + 3) { transform: rotate(-0.3deg); }
.home-category-note:nth-child(4n + 4) { transform: rotate(0.25deg); }

/* View Specific UI Panels — container sizing handled by Tailwind classes on the elements */

.request-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.request-grid, .editor-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

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

/* Editor Cards */
.editor-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.editor-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #f1f5f9;
}

.editor-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: #1e293b;
}

.editor-role {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.editor-bio {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.5;
}

/* Requests / Editors visibility is handled by section.requests-view / section.editors-view
   in the Global Section Visibility block above (line ~36-49). */

/* Hero card for special views */
.special-view-hero {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.special-view-hero .paper-clip {
  top: -12px;
  right: 40px;
}

.special-view-title {
  font-size: 1.875rem;
  font-weight: 900;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  line-height: 1.2;
}

.special-view-desc {
  margin-top: 1rem;
  color: #64748b;
  font-weight: 500;
  max-width: 600px;
}

.special-view-actions {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Cards for special views */
.special-card-list {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
}

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

.special-item-card {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  transition: transform 0.2s;
}

.special-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

/* ===== Unified container overrides =====
   All view sections share the same container as homeView:
   max-w-[1200px] mx-auto, responsive px/py.
   Override base rules in site.css that set fixed padding / narrower max-width. */

section#categoryView.category-view,
section#requestsView.requests-view,
section#commentsView.requests-view,
section#editorsView.editors-view,
section#glossaryView.glossary-view {
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  padding-top: 1.5rem !important;
  padding-bottom: 1.5rem !important;
}

@media (min-width: 640px) {
  section#categoryView.category-view,
  section#requestsView.requests-view,
  section#commentsView.requests-view,
  section#editorsView.editors-view,
  section#glossaryView.glossary-view {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}

@media (min-width: 1024px) {
  section#categoryView.category-view,
  section#requestsView.requests-view,
  section#commentsView.requests-view,
  section#editorsView.editors-view,
  section#glossaryView.glossary-view {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
}

/* article-view container: unified with all views */
section.article-view {
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  padding-top: 1.5rem !important;
  padding-bottom: 1.5rem !important;
}

@media (min-width: 640px) {
  section.article-view {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}

@media (min-width: 1024px) {
  section.article-view {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
}

/* breadcrumb position: unified across all pages */
.article-view .article-breadcrumb,
.category-view .article-breadcrumb,
.requests-view .article-breadcrumb,
.editors-view .article-breadcrumb,
.glossary-view .article-breadcrumb {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* breadcrumb → 直後カードのgapを詰める（space-y-8の2remを0.75remに） */
.category-view .article-breadcrumb + *,
.requests-view .article-breadcrumb + *,
.editors-view .article-breadcrumb + *,
.glossary-view .article-breadcrumb + *,
.article-view .article-breadcrumb + * {
  margin-top: 0.75rem !important;
}

/* article header cleanup (index2) */
.article-breadcrumb {
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #64748b;
  margin-bottom: 0.5rem;
  display: block;
}

.article-breadcrumb span {
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #2563eb !important; /* Blue color for links */
  display: inline-block;
  cursor: pointer;
}

.article-breadcrumb span.sep {
  color: #64748b !important; /* Keep separators gray */
  cursor: default;
  margin: 0 4px;
}

.article-breadcrumb span:hover {
  text-decoration: underline;
}

#articleView #articleEyebrow,
#articleView #articleName {
  display: none !important;
}

#articleView #articleTitle {
  font-family: "Inter", "Noto Sans JP", sans-serif;
  font-weight: 800;
}

/* header text-only nav (index2) */
body.index2-preview .header .header-inner {
  max-width: 1200px !important;
  padding: 0 1rem !important; /* px-4 equivalent */
  margin: 0 auto !important;
}

@media (min-width: 640px) {
  body.index2-preview .header .header-inner {
    padding: 0 1.5rem !important; /* sm:px-6 */
  }
}

@media (min-width: 1024px) {
  body.index2-preview .header .header-inner {
    padding: 0 2rem !important; /* lg:px-8 */
  }
}

body.index2-preview .header .header-route-btn,
body.index2-preview .header .admin-login-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 4px 2px !important;
  min-height: 0 !important;
  min-width: 0 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #334155 !important;
}

body.index2-preview .header .header-route-btn:hover,
body.index2-preview .header .admin-login-btn:hover {
  color: #2563eb !important;
}

body {
  font-family: 'Inter', 'Noto Sans JP', sans-serif !important;
  transition: background-color 0.3s, color 0.3s;
}

body[data-theme="light"] {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

body[data-theme="dark"] {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
}

/* Article List & Rows (Sticky Note Style) */
.article-list, 
#categoryArticleList, 
#glossaryArticleList {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 20px !important;
  padding: 10px 0 !important;
}

@media (max-width: 640px) {
  .article-list {
    grid-template-columns: 1fr !important;
  }
}

.article-list .article-row,
#categoryArticleList .article-row,
#glossaryArticleList .article-row,
.article-row.article-row {
  background-color: #f1f5f9 !important; /* Lighter gray as requested */
  border: 1px solid #e2e8f0 !important; /* Lighter gray border */
  border-radius: 2px !important;
  padding: 32px 16px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  min-height: 100px !important;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none !important;
  color: #334155 !important;
  position: relative !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Tape/Sticker Decoration (Washi Tape style) */
.article-row::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg); /* Slightly tilted */
  width: 80px;
  height: 24px;
  background-color: rgba(203, 213, 225, 0.7) !important; /* Semi-transparent gray */
  background-image: linear-gradient(to right, rgba(0,0,0,0.02) 0%, transparent 50%, rgba(0,0,0,0.02) 100%);
  
  /* Torn edge effect using clip-path */
  clip-path: polygon(
    2% 0%, 98% 0%, 
    100% 15%, 98% 30%, 100% 45%, 98% 60%, 100% 75%, 98% 90%, 100% 100%, 
    0% 100%, 
    2% 90%, 0% 75%, 2% 60%, 0% 45%, 2% 30%, 0% 15%
  );
  
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  pointer-events: none;
}

/* Variation for tape rotation */
.article-row:nth-child(even)::before { transform: translateX(-50%) rotate(1.8deg); }
.article-row:nth-child(odd)::before { transform: translateX(-50%) rotate(-2.2deg); }
.article-row:nth-child(3n)::before { transform: translateX(-50%) rotate(0.5deg); }

/* Rotation for Article Notes */
.article-row:nth-child(even) { transform: rotate(1deg); }
.article-row:nth-child(odd) { transform: rotate(-1deg); }
.article-row:nth-child(3n) { transform: rotate(0.5deg); }

.article-row:hover {
  transform: scale(1.01) translateY(-2px) rotate(0deg) !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
  z-index: 20;
}

.article-title-row {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-all;
}

.article-arrow {
  display: none !important; /* Arrow not needed for sticky note style */
}

/* Dark Mode Overrides for Entire Page */
body[data-theme="dark"] .bg-white {
  background-color: #1e293b !important;
}

body[data-theme="dark"] .text-slate-700,
body[data-theme="dark"] .text-slate-900 {
  color: #f1f5f9 !important;
}

body[data-theme="dark"] .bg-slate-100 {
  background-color: #1e293b !important;
}

body[data-theme="dark"] .border-slate-200 {
  border-color: #334155 !important;
}

/* Sticky note containers in dark mode */
body[data-theme="dark"] .bg-sticky-yellow {
  background-color: #2a2a1a !important;
}
body[data-theme="dark"] .bg-sticky-blue {
  background-color: #172033 !important;
}
body[data-theme="dark"] .sticky-note.bg-sticky-yellow,
body[data-theme="dark"] .sticky-note.bg-sticky-blue {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

/* Section title labels (h3 on sticky) in dark mode */
body[data-theme="dark"] .text-slate-800 {
  color: #e2e8f0 !important;
}
body[data-theme="dark"] h3.text-sm.font-bold.text-slate-800 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* Article Notes in Dark Mode - Improved Visibility */
body[data-theme="dark"] .article-list .article-row,
body[data-theme="dark"] #categoryArticleList .article-row,
body[data-theme="dark"] #glossaryArticleList .article-row,
body[data-theme="dark"] .article-row.article-row {
  background-color: #334155 !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

body[data-theme="dark"] .article-title-row {
  color: #f8fafc !important;
}

body[data-theme="dark"] .article-row::before {
  background-color: rgba(148, 163, 184, 0.8) !important; /* Visible washi tape in dark mode */
  background-image: linear-gradient(to right, rgba(255,255,255,0.05) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
  opacity: 1;
}

/* Breadcrumbs Styling */
.breadcrumb-container, .breadcrumb-row {
  font-size: 10px !important;
  font-weight: 700 !important;
  margin-bottom: 12px !important;
}

.breadcrumb-container a {
  color: #2563eb !important; /* Blue links as requested */
  text-decoration: none;
}

.breadcrumb-container .separator {
  color: #94a3b8 !important;
  margin: 0 6px;
}

body[data-theme="dark"] .article-row::before {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== CSS variable fallbacks (--mono / --font-ui-* not defined in site.css :root) ===== */
:root {
  --mono: "Inter", "Noto Sans JP", sans-serif;
  --font-ui-sm: 11px;
  --font-ui-md: 13px;
  --font-ui-lg: 15px;
  --ui-control-h-sm: 28px;
  --ui-radius-sm: 6px;
}

/* ===== Admin menu dropdown: explicit bg/border so it's visible regardless of --bg2/--bg3 ===== */
.admin-nav-wrap.is-open .header-admin-menu {
  background: #ffffff !important;
  border-color: rgba(17, 50, 79, 0.22) !important;
  box-shadow: 0 14px 28px rgba(19, 40, 63, 0.2) !important;
}
body[data-theme="dark"] .admin-nav-wrap.is-open .header-admin-menu {
  background: #1e293b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5) !important;
}
.header-admin-menu-btn {
  color: #123554 !important;
  background: rgba(40, 118, 188, 0.08) !important;
  border-color: rgba(17, 50, 79, 0.2) !important;
}
body[data-theme="dark"] .header-admin-menu-btn {
  color: #94c5f8 !important;
  background: rgba(40, 118, 188, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* ===== Container padding-top: 上詰め ===== */
section#categoryView.category-view,
section#requestsView.requests-view,
section#commentsView.requests-view,
section#editorsView.editors-view,
section#glossaryView.glossary-view,
section.article-view {
  padding-top: 0 !important;
}

/* ===== Mobile menu copyright ===== */
.mobile-menu-copy {
  margin-top: 4px;
  padding: 8px 10px 4px;
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  border-top: 1px solid rgba(0,0,0,0.08);
}
body[data-theme="dark"] .mobile-menu-copy {
  color: #64748b;
  border-top-color: rgba(255,255,255,0.08);
}

/* ===== Mobile fixes ===== */
@media (max-width: 768px) {
  /* Mobile menu panel: ensure it doesn't overflow screen */
  .mobile-menu-panel {
    max-height: calc(100vh - 80px) !important;
    overflow-y: auto !important;
  }

  /* Article view: tighter layout on mobile */
  .article-content-card {
    border-radius: 12px !important;
    padding: 16px 16px 14px !important;
  }

  /* Article title: smaller on mobile */
  .article-title {
    font-size: 1.3rem !important;
  }

  /* Comment panel: ensure readable on mobile */
  .comment-panel {
    margin-top: 16px !important;
  }

  /* Glossary add button: smaller on mobile */
  #glossaryAddBtn {
    font-size: 12px !important;
    padding: 6px 12px !important;
  }

  /* Filter chips: wrap on mobile */
  .filter-chip-group {
    flex-wrap: wrap !important;
  }

  /* Tool tabs: wrap on mobile */
  .tool-tabs {
    flex-wrap: wrap !important;
  }

  /* Footer nav: wrap on mobile */
  .app-footer nav {
    gap: 8px 12px !important;
  }

  /* Modal: full width on small screens */
  .modal-box {
    padding: 20px 16px !important;
    border-radius: 12px !important;
  }
  .modal-large-box {
    max-height: 92vh !important;
    overflow-y: auto !important;
  }

  /* Breadcrumb: compact on mobile */
  .article-breadcrumb {
    font-size: 10px !important;
    margin-bottom: 8px !important;
    flex-wrap: wrap !important;
  }
}

/* ===== Tool tabs: filter-chip style ===== */
.tool-tabs {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  gap: 6px !important;
  margin-bottom: 12px !important;
  flex-wrap: wrap !important;
}
.tool-tab {
  padding: 4px 12px !important;
  font-size: 11px !important;
  min-height: 0 !important;
  border-radius: 20px !important;
  font-family: "Inter", "Noto Sans JP", sans-serif !important;
  letter-spacing: 0 !important;
  border: 1px solid rgba(18,22,26,0.14) !important;
  background: #fff !important;
  color: #475569 !important;
  font-weight: 600 !important;
  transition: all .15s !important;
}
.tool-tab:hover:not(.active) {
  border-color: rgba(18,22,26,0.25) !important;
  color: #1e293b !important;
  transform: translateY(-1px) !important;
}
.tool-tab.active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}
body[data-theme="dark"] .tool-tab {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
body[data-theme="dark"] .tool-tab.active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}

/* ===== Filter chips (hashtag): チップサイズ縮小 ===== */
.filter-chip {
  padding: 3px 10px !important;
  font-size: 11px !important;
  border-radius: 14px !important;
  font-family: "Inter", "Noto Sans JP", sans-serif !important;
}

/* ===== Article updated date: フォント縮小・統一 ===== */
.article-view .article-updated,
.article-updated {
  font-family: "Inter", "Noto Sans JP", sans-serif !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
  line-height: 1.4 !important;
}

/* ===== Footer: font fix ===== */
.app-footer,
.app-footer * {
  font-family: "Inter", "Noto Sans JP", sans-serif !important;
  font-size: 11px !important;
}

/* ===== Font unification: Inter / Noto Sans JP ===== */
body.index2-preview .article-body,
body.index2-preview .article-title-row,
body.index2-preview .comment-title,
body.index2-preview .comment-item,
body.index2-preview .comment-author,
body.index2-preview .comment-body,
body.index2-preview .modal-title,
body.index2-preview .modal-input,
body.index2-preview .modal-textarea,
body.index2-preview .modal-btn,
body.index2-preview .comment-open-btn {
  font-family: "Inter", "Noto Sans JP", sans-serif !important;
}

/* ===== Dark mode visibility improvements ===== */
body[data-theme="dark"] {
  color: #e2e8f0;
}
body[data-theme="dark"] .header {
  background: #0f172a !important;
  border-bottom-color: rgba(255,255,255,0.08) !important;
}
body[data-theme="dark"] .nav-btn,
body[data-theme="dark"] .header-btn-main {
  color: #cbd5e1 !important;
}
body[data-theme="dark"] .nav-btn:hover {
  color: #f1f5f9 !important;
  background: rgba(255,255,255,0.08) !important;
}
body[data-theme="dark"] .app-footer {
  background: #0f172a !important;
  color: #64748b !important;
  border-top-color: rgba(255,255,255,0.08) !important;
}
body[data-theme="dark"] .app-footer a,
body[data-theme="dark"] .app-footer button {
  color: #94a3b8 !important;
}
body[data-theme="dark"] .app-footer a:hover,
body[data-theme="dark"] .app-footer button:hover {
  color: #60a5fa !important;
}
body[data-theme="dark"] .article-breadcrumb span {
  color: #60a5fa !important;
}
body[data-theme="dark"] .article-breadcrumb span.sep {
  color: #475569 !important;
}
body[data-theme="dark"] .article-updated,
body[data-theme="dark"] .article-meta-row {
  color: #94a3b8 !important;
}
body[data-theme="dark"] .filter-chip {
  background: #1e293b !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
body[data-theme="dark"] .filter-chip.active,
body[data-theme="dark"] .filter-chip:hover {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}
body[data-theme="dark"] .tool-tab {
  color: #94a3b8 !important;
}
body[data-theme="dark"] .tool-tab.active {
  background: #2563eb !important;
  color: #fff !important;
}
body[data-theme="dark"] .modal-box {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}
body[data-theme="dark"] .modal-input,
body[data-theme="dark"] .modal-textarea {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
body[data-theme="dark"] .modal-title,
body[data-theme="dark"] .modal-head {
  color: #f1f5f9 !important;
}
body[data-theme="dark"] .mobile-menu-panel {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}
body[data-theme="dark"] .mobile-menu-item {
  color: #cbd5e1 !important;
  border-bottom-color: rgba(255,255,255,0.06) !important;
}
body[data-theme="dark"] .mobile-menu-item:hover {
  background: rgba(255,255,255,0.06) !important;
}
body[data-theme="dark"] .comment-panel {
  background: #0f172a !important;
}
body[data-theme="dark"] .comment-item {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
body[data-theme="dark"] .comment-author {
  color: #94a3b8 !important;
}
body[data-theme="dark"] .glossary-tooltip {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
}

/* ===== Focus ring 除去（ヘッダー・ボタンクリック時の謎装飾） ===== */
.header *:focus,
.header *:focus-visible,
.nav-btn:focus,
.nav-btn:focus-visible,
.mobile-menu-btn:focus,
.mobile-menu-btn:focus-visible,
.logo:focus,
.logo:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* ===== Dark mode: ヘッダーボタン・ナビボタンの視認性 ===== */
body[data-theme="dark"] .nav-btn.ghost,
body[data-theme="dark"] .admin-login-btn,
body[data-theme="dark"] .header-btn-main {
  color: #e2e8f0 !important;
  border-color: rgba(255,255,255,0.18) !important;
  background: rgba(255,255,255,0.06) !important;
}
body[data-theme="dark"] .nav-btn.ghost:hover,
body[data-theme="dark"] .admin-login-btn:hover,
body[data-theme="dark"] .header-btn-main:hover {
  color: #ffffff !important;
  background: rgba(255,255,255,0.12) !important;
  border-color: rgba(255,255,255,0.28) !important;
}
body[data-theme="dark"] .mobile-menu-btn {
  color: #e2e8f0 !important;
}

/* Modal Buttons Visibility in Dark Mode */
body[data-theme="dark"] .modal-btn.primary {
  background: #2563eb !important;
  color: #ffffff !important;
}
body[data-theme="dark"] .modal-btn.ghost {
  color: #cbd5e1 !important;
  border-color: rgba(255,255,255,0.2) !important;
  background: rgba(255,255,255,0.05) !important;
}
body[data-theme="dark"] .modal-btn.ghost:hover {
  background: rgba(255,255,255,0.1) !important;
  color: #ffffff !important;
}

/* Glossary Card Styles (指示.md) */
#glossaryArticleList .article-row {
  text-align: center !important; /* Title centered */
  padding-bottom: 1.5rem !important;
}
#glossaryArticleList .article-title-row {
  margin-bottom: 8px;
}
/* Body text left-aligned for glossary items */
.glossary-row-desc {
  text-align: left !important;
  font-size: 11px;
  color: #64748b;
  width: 100%;
  margin-top: 10px;
  padding: 0 4px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
body[data-theme="dark"] .glossary-row-desc {
  color: #94a3b8;
}

/* Mobile Display Optimizations (指示.md) */
@media (max-width: 640px) {
  #articleView .article-title {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }
  #articleView .article-content-card {
    padding: 1.5rem !important;
  }
  .sticky-note {
    padding: 1.5rem !important;
  }
  .modal-box {
    padding: 1.25rem !important;
  }
  .modal-head .modal-title {
    font-size: 1rem !important;
  }
  /* Sticky note rotations can be subtle on mobile */
  .sticky-note, .article-row {
    transform: rotate(0deg) !important;
  }
  .article-breadcrumb {
    font-size: 10px !important;
    flex-wrap: wrap;
    gap: 4px;
  }
}


/* Glossary System */
.glossary-term {
  border-bottom: 1.5px dotted #2563eb;
  cursor: help;
  color: inherit;
  transition: all 0.2s;
}
.glossary-term:hover {
  background: rgba(37, 99, 235, 0.05);
  border-bottom-style: solid;
}

#glossary-popup {
  position: fixed;
  z-index: 9999;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  max-width: 300px;
  pointer-events: none;
  font-size: 13px;
  line-height: 1.6;
  display: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.glossary-popup-term {
  display: block;
  font-weight: 900;
  color: #2563eb;
  margin-bottom: 6px;
  font-size: 14px;
}

.glossary-popup-desc {
  display: block;
  color: #475569;
  font-weight: 500;
}

body[data-theme="dark"] #glossary-popup {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

body[data-theme="dark"] .glossary-popup-desc {
  color: #cbd5e1;
}
body[data-theme="dark"] .glossary-tooltip {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
body[data-theme="dark"] .glossary-tooltip-desc {
  color: #cbd5e1;
}

/* Admin Actions Visibility */
.admin-article-actions {
  display: none;
  gap: 8px;
}
.admin-article-actions.visible {
  display: flex !important;
}
.admin-article-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  background: #ffffff;
  color: #475569;
  transition: all 0.2s;
}
.admin-article-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}
.admin-article-btn.danger:hover {
  border-color: #ef4444;
  color: #ef4444;
}
body[data-theme="dark"] .admin-article-btn {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}

/* Modal System (指示.md) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(4px);
  z-index: 1000 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex !important;
}

.modal-box {
  background: white;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
}

.modal-head {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
}

.modal-foot {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-close {
  color: #94a3b8;
  hover: color: #475569;
  transition: color 0.2s;
  font-size: 1.5rem;
  line-height: 1;
}

/* Admin Menu Dropdown (指示.md) */
.admin-nav-wrap {
  position: relative;
}

.header-admin-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 180px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  padding: 8px;
  z-index: 500;
  transform: translateY(-4px);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
}

.admin-nav-wrap.open .header-admin-menu {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

.header-admin-menu-btn {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  border-radius: 6px;
  transition: all 0.2s;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.header-admin-menu-btn:hover {
  background: #f1f5f9;
  color: #2563eb;
}

.header-admin-menu-btn.primary {
  color: #2563eb;
  background: #eff6ff;
  margin-bottom: 4px;
}

body[data-theme="dark"] .header-admin-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

body[data-theme="dark"] .header-admin-menu-btn {
  color: #cbd5e1;
}

body[data-theme="dark"] .header-admin-menu-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #60a5fa;
}
body[data-theme="dark"] .header-admin-menu-btn.primary {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
}

/* List Layout Utilities (指示.md) */
.list-row--stack {
  flex-direction: column !important;
  align-items: flex-start !important;
  padding: 1.25rem !important;
  gap: 12px !important;
}

.list-row-main-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.request-row-body, .comment-row-body {
  display: block;
  font-size: 13px;
  line-height: 1.6;
  color: #475569;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 4px;
}

body[data-theme="dark"] .request-row-body, 
body[data-theme="dark"] .comment-row-body {
  color: #94a3b8;
}

.request-row-meta {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
  width: 100%;
}

body[data-theme="dark"] .request-row-meta {
  border-top-color: #334155;
}



/* --- Article Body Decorations (Notebook style) --- */
.article-body {
  font-size: 15px;
  color: var(--ink);
  line-height: 1.8;
}

.article-body p,
.article-body ul:not(.point-list) li,
.article-body ol li {
  background-image: radial-gradient(
    circle at 50% calc(100% - 1px),
    rgba(178, 151, 116, 0.25) 0 0.8px,
    transparent 0.9px
  );
  background-size: 100% 2.4em;
  line-height: 2.4;
  margin-bottom: 1.2em;
}

.article-body h2, .article-body h3 {
  font-size: 1.4em;
  border-left: 5px solid var(--accent);
  padding-left: 14px;
  margin-top: 1.8em;
  margin-bottom: 1.2em;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.3;
}

.article-body h2:first-child, .article-body h3:first-child {
  margin-top: 0.2em !important;
}

.article-body strong {
  background: linear-gradient(transparent 70%, var(--tag-yellow) 70%);
  padding: 0 2px;
}

.article-body blockquote {
  border-left: 4px solid #e2e8f0;
  background: #f8fafc;
  padding: 16px 24px;
  font-style: italic;
  color: #64748b;
  border-radius: 0 12px 12px 0;
}

/* --- Glossary Tooltips --- */
.glossary-tooltip {
  border-bottom: 1px dotted #94a3b8; /* Subtle grey dotted line */
  cursor: help;
  color: inherit;
  transition: all 0.2s;
}

.glossary-tooltip:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-soft);
}

/* Tippy.js or Native Title will work, but let's make a basic pure CSS tooltip fallback if needed, 
   though we'll use a better approach in JS. */

/* ── NEW SPLIT HERO ── */
.hero-dot-grid {
  background-image: radial-gradient(#e2e8f0 0.8px, transparent 0.8px);
  background-size: 24px 24px;
}

.glass-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.05);
}

.hero-search-wrap {
  position: relative;
  max-width: 480px;
}

.hero-search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  background: white !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.hero-search-input:focus {
  outline: none;
  border-color: #3b82f6 !important;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12) !important;
  transform: translateY(-1px);
}

.hero-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  z-index: 10;
}

.floating-card-1 { --rot: -2deg; animation: float 5s ease-in-out infinite; }
.floating-card-2 { --rot: 3deg; animation: float 7s ease-in-out infinite 1s; }
.floating-card-3 { --rot: -1deg; animation: float 6s ease-in-out infinite 0.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-10px) rotate(var(--rot, 0deg)); }
}

/* Hero Sticky Cards Responsive */
.hero-sticky-card {
  transform: translate(var(--off-x), var(--off-y));
}

@media (max-width: 768px) {
  .hero-sticky-card {
    /* Scale down cards and condense offsets on mobile */
    transform: translate(calc(var(--off-x) * 0.45), calc(var(--off-y) * 0.35)) scale(0.85);
  }
}

.perspective-1000 {
  perspective: 1000px;
}
