/* ============================================
   BRIDGE Common Styles
   Shared across all pages
   ============================================ */

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

:root {
  /* Brand */
  --brand: #E6641E;
  --brand-hover: #d45a1a;
  --brand-light: #fff3ed;

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-caption: #9ca3af;
  --text-inverse: #ffffff;

  /* Background */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-warm: #FAF6F2;
  --bg-warm-deep: #F5EDE6;
  --bg-warm-light: #FBF8F5;
  --bg-header: #131315;
  --bg-topic-bar: #2a2b31;

  /* Border */
  --border: #e5e7eb;
  --border-light: #f3f4f6;

  /* Font */
  --font-sans: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: "Zilla Slab", Georgia, "Times New Roman", serif;

  /* Spacing */
  --container: 1200px;
  --gutter: 1.5rem;

  /* Header */
  --header-height: 60px;
  --topic-bar-height: 40px;

  /* Radius */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 4px;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ============================================
   HEADER
   ============================================ */

.site-header {
  background: var(--bg-header);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  position: relative;
}

.site-logo {
  display: flex;
  align-items: center;
}

.site-logo img {
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2.25rem;
}

.header-nav-label {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
}

.header-nav a {
  font-family: var(--font-heading);
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: var(--brand);
}

.header-search {
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: color 0.2s;
}

.header-search:hover {
  color: var(--text-inverse);
}

.header-mypage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.125rem;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.18);
  transition: all 0.25s ease;
  white-space: nowrap;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.header-mypage:hover {
  border-color: var(--brand);
  color: var(--text-inverse);
  background: rgba(230, 100, 30, 0.1);
  box-shadow: 0 0 12px rgba(230, 100, 30, 0.15);
}

.header-mypage svg {
  opacity: 0.6;
  transition: opacity 0.25s;
}

.header-mypage:hover svg {
  opacity: 1;
}

/* Header Logo Wrap (scroll-triggered) */
.header-logo-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.site-header.logo-visible .header-logo-wrap {
  opacity: 1;
  pointer-events: auto;
}

.header-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-logo img {
  height: 28px;
  width: auto;
}

/* Ornament flanking logo */
.header-logo-ornament {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-logo-ornament.left {
  margin-right: 12px;
}

.header-logo-ornament.right {
  margin-left: 12px;
}

.ornament-line {
  display: block;
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.1));
}

.header-logo-ornament.right .ornament-line {
  background: linear-gradient(90deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
}

.ornament-dot {
  display: block;
  width: 4px;
  height: 4px;
  background: var(--brand);
  border-radius: 1px;
  transform: rotate(45deg);
  opacity: 0.5;
}

/* Topic Bar */
.topic-bar {
  background: var(--bg-topic-bar);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.topic-bar-inner {
  display: flex;
  align-items: center;
  height: var(--topic-bar-height);
  gap: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-bar-inner::-webkit-scrollbar {
  display: none;
}

.topic-bar-label {
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.topic-bar a {
  color: rgba(255,255,255,0.5);
  font-size: 0.8125rem;
  font-weight: 400;
  white-space: nowrap;
  transition: color 0.2s;
}

.topic-bar a:hover {
  color: var(--brand);
}

/* Header Newsletter (in topic bar) */
.header-newsletter {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.08);
}

.site-header.logo-visible .header-newsletter {
  opacity: 1;
  pointer-events: auto;
}

.header-newsletter-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 500;
  font-style: italic;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  letter-spacing: 0;
  flex-shrink: 0;
}

.header-nl-dot {
  display: block;
  width: 5px;
  height: 5px;
  background: var(--brand);
  border-radius: 1px;
  transform: rotate(45deg);
  flex-shrink: 0;
  opacity: 0.7;
}

.header-newsletter-form {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-newsletter-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-right: none;
  border-radius: 3px 0 0 3px;
  color: var(--text-inverse);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  padding: 0.3125rem 0.625rem;
  outline: none;
  width: 150px;
  transition: border-color 0.2s, background 0.2s;
}

.header-newsletter-input::placeholder {
  color: rgba(255,255,255,0.25);
}

.header-newsletter-input:focus {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.header-newsletter-btn {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  border-radius: 0 3px 3px 0;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.3125rem 0.625rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  letter-spacing: 0.02em;
}

.header-newsletter-btn:hover {
  background: var(--brand-hover);
}

/* ============================================
   SIDE MENU
   ============================================ */

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  transition: color 0.2s;
  padding: 0;
  position: relative;
  z-index: 201;
}

.menu-toggle:hover {
  color: var(--text-inverse);
}

.menu-toggle .bar {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
  position: absolute;
}

.menu-toggle .bar:nth-child(1) { transform: translateY(-6px); }
.menu-toggle .bar:nth-child(2) { transform: translateY(0); }
.menu-toggle .bar:nth-child(3) { transform: translateY(6px); }

.menu-toggle.active .bar:nth-child(1) { transform: rotate(45deg); }
.menu-toggle.active .bar:nth-child(2) { opacity: 0; }
.menu-toggle.active .bar:nth-child(3) { transform: rotate(-45deg); }

.side-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.side-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: var(--bg-header);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: calc(var(--header-height) + 2rem) 2rem 2.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.side-menu::-webkit-scrollbar {
  width: 4px;
}

.side-menu::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

.side-menu.active {
  transform: translateX(0);
}

.side-menu-section {
  margin-bottom: 2.5rem;
}

.side-menu-section-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 500;
  font-style: italic;
  color: var(--brand);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  line-height: 1;
}

.side-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 0.625rem;
  color: rgba(255,255,255,0.6);
  font-size: 1.0625rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.side-menu-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.side-menu-item.active {
  background: rgba(230, 100, 30, 0.15);
  color: var(--brand);
}

.side-menu-item img {
  width: 100%;
  max-width: 260px;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.side-menu-all {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0.625rem;
  color: rgba(255,255,255,0.9);
  font-size: 1.1875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 1.25rem;
  transition: color 0.2s;
}

.side-menu-all:hover {
  color: var(--brand);
}

.side-menu-all.active {
  color: var(--brand);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  align-self: start;
  position: sticky;
  top: calc(var(--header-height) + var(--topic-bar-height) + 1.5rem);
  max-height: calc(100vh - var(--header-height) - var(--topic-bar-height) - 3rem);
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.sidebar-panel {
  display: none !important;
}

.sidebar-panel.active {
  display: block !important;
  animation: sidebarFadeIn 0.35s ease forwards;
}

@keyframes sidebarFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-widget {
  background: var(--bg-warm-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.sidebar-widget .widget-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  font-style: normal;
  text-transform: none;
  letter-spacing: -0.01em;
  margin-bottom: 0.875rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  line-height: 1;
}

.sidebar-widget .widget-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--brand);
  border-radius: 1px;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.sidebar-widget .widget-title::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--brand);
}

.sidebar-ranking {
  list-style: none;
}

.sidebar-ranking li {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
}

.sidebar-ranking li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.rank-number {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--brand);
  min-width: 1.75rem;
  line-height: 1.1;
  flex-shrink: 0;
}

.rank-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.rank-body,
.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-title {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rank-title a {
  color: inherit;
  text-decoration: none;
}

.rank-title a:hover {
  color: var(--brand);
}

.rank-date {
  font-size: 0.6875rem;
  color: var(--text-caption);
  margin-top: 0.125rem;
}

/* ============================================
   LOADING
   ============================================ */

.load-more-sentinel {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.load-end {
  text-align: center;
  color: var(--text-caption);
  font-size: 0.8125rem;
  padding: 1rem 0;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  background: var(--bg-header);
  color: rgba(255,255,255,0.6);
  padding: 3rem 0 1.5rem;
  margin-top: 3rem;
  border-top: 3px solid var(--brand);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand .site-logo {
  margin-bottom: 1rem;
}

.footer-brand p {
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-col h4 {
  font-family: var(--font-heading);
  color: var(--text-inverse);
  font-size: 1.0625rem;
  font-weight: 500;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0.875rem;
  line-height: 1;
}

.footer-col a {
  display: block;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: rgba(255,255,255,0.9);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.footer-social a {
  color: rgba(255,255,255,0.4);
  transition: color 0.2s;
}

.footer-social a:hover {
  color: var(--brand);
}

/* ============================================
   SHARED POST LIST (archive pages)
   ============================================ */

.post-list-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.25rem;
  align-items: start;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
}

.post-list-item:first-child {
  padding-top: 0;
}

.post-list-item .list-image {
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-md);
  transition: opacity 0.2s;
}

.post-list-item:hover .list-image {
  opacity: 0.85;
}

.post-list-item .list-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-list-item .category-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--brand);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.post-list-item .list-title {
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 0.375rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-list-item .list-title a {
  color: inherit;
  text-decoration: none;
}

.post-list-item .list-title a:hover {
  color: var(--brand);
}

.post-list-item .list-excerpt {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.375rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-list-item .card-meta {
  font-size: 0.75rem;
  color: var(--text-caption);
}

.post-list-item.pattern-featured {
  grid-template-columns: 1fr;
  gap: 1rem;
}

.post-list-item.pattern-featured .list-image {
  aspect-ratio: 16/9;
}

.post-list-item.pattern-featured .list-title {
  font-size: 1.375rem;
}

/* ============================================
   UTILITIES
   ============================================ */

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

/* ============================================
   RESPONSIVE (shared)
   ============================================ */

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --gutter: 1rem;
    --header-height: 52px;
  }

  .header-nav {
    display: none;
  }

  .header-newsletter {
    display: none !important;
  }

  .header-mypage span,
  .header-mypage {
    font-size: 0;
    padding: 0.5rem;
    gap: 0;
  }

  .header-mypage svg {
    width: 18px;
    height: 18px;
  }

  .header-logo-ornament {
    display: none;
  }

  .header-logo img {
    height: 22px;
  }

  .side-menu {
    width: 85vw;
    max-width: 380px;
  }

  .topic-bar-inner {
    gap: 1rem;
  }

  .topic-bar-label {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .post-list-item {
    grid-template-columns: 100px 1fr;
    gap: 0.875rem;
    padding: 1.25rem 0;
  }

  .post-list-item .list-title {
    font-size: 0.9375rem;
  }

  .post-list-item .list-excerpt {
    display: none;
  }

  .post-list-item.pattern-featured {
    grid-template-columns: 1fr;
  }

  .post-list-item.pattern-featured .list-title {
    font-size: 1.125rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
