/*
 * nd-algorithm-updates.css — Googleアルゴリズムアップデート一覧
 * ================================================================
 * Page-scoped styles for /google-algorithm-updates/
 * Loaded only on this page via functions.php is_page() conditional.
 *
 * What this file does NOT contain (already in global stack):
 *   - :root tokens (nd-tokens.css)
 *   - html/body/a/button resets (nd-base.css)
 *   - .wrap / .wrap-mid layout (nd-global.css)
 *   - Header, footer, breadcrumb (nd-global.css)
 *
 * What this file adds:
 *   - --cat-* categorical badge palette (6 new variables)
 *   - Page header (.page-head, .kicker, .page-h1, .page-dek, .page-stats)
 *   - Legend strip (.legend, .lg-item, .lg-dot, .lg-tip tooltip)
 *   - Year filter bar (.filterbar, .yr-btn)
 *   - Timeline / logbook (.log, .year-group, .year-head, .entry)
 *   - Footer note (.foot-note)
 *   - Motion (reveal, filter fade)
 *   - Responsive overrides for this page
 */


/* ─── 1. CATEGORICAL BADGE PALETTE ──────────────────────────────
   6 new variables. Same muted, earthy register as --kaki/--matcha.
   Not added to nd-tokens.css as they are page-scoped.            */
:root {
  --cat-core:          #d96a3a;                        /* コア    — kaki        */
  --cat-core-soft:     #fde8db;
  --cat-spam:          oklch(0.525 0.085 354);          /* スパム  — 梅紫 plum   */
  --cat-spam-soft:     oklch(0.955 0.022 354);
  --cat-hcu:           #5e7140;                        /* HCU     — matcha      */
  --cat-hcu-soft:      #e6ebd9;
  --cat-review:        oklch(0.555 0.072 74);           /* レビュー — 黄土 ochre */
  --cat-review-soft:   oklch(0.952 0.04 80);
  --cat-discover:      oklch(0.52 0.062 246);           /* Discover — 藍 slate  */
  --cat-discover-soft: oklch(0.953 0.022 244);
  --cat-other:         #5a5a55;                        /* その他  — ink         */
  --cat-other-soft:    #ebe7dd;
}


/* ─── 2. PAGE HEADER ─────────────────────────────────────────── */
.page-head { padding: 20px 0 48px; }

.page-head .kicker {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--kaki);
  text-transform: uppercase;
  margin: 0 0 16px;
}

.page-h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 42px;
  letter-spacing: .5px;
  line-height: 1.18;
  margin: 0 0 18px;
  color: var(--ink);
  text-wrap: pretty;
}

.page-dek {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.95;
  margin: 0 0 36px;
  max-width: 680px;
}

.page-stats {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 11px;
  color: var(--ink-3);
  flex-wrap: wrap;
}

.page-stats .item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.page-stats svg { color: var(--ink-3); }

.page-stats strong {
  color: var(--ink-2);
  font-weight: 500;
  font-family: var(--serif);
  font-size: 13px;
  margin: 0 2px;
}


/* ─── 3. LEGEND STRIP ────────────────────────────────────────── */
.legend {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  padding: 28px 0 0;
  margin-top: 36px;
  border-top: 1px dashed var(--hairline);
}

.legend .lg-label {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.legend .lg-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
  font-family: var(--sans);
  background: transparent;
  border: 0;
  padding: 4px 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: color var(--hover-dur) var(--ease-soft);
}

.legend .lg-item:hover { color: var(--ink); }

.legend .lg-item.is-active {
  color: var(--ink);
  font-weight: 500;
}

.legend .lg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: box-shadow var(--hover-dur) var(--ease-soft);
}

.legend .lg-item.is-active .lg-dot {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--paper) 100%, transparent),
              0 0 0 4px currentColor;
}

/* Legend tooltip — JS-positioned, plain text */
.lg-tip {
  position: absolute;
  z-index: 60;
  max-width: 340px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: .2px;
  padding: 11px 14px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 200ms var(--ease-soft), transform 200ms var(--ease-soft);
}

.lg-tip.show {
  opacity: 1;
  transform: translateY(0);
}

.lg-tip::after {
  content: "";
  position: absolute;
  top: -5px;
  left: var(--ax, 20px);
  width: 10px;
  height: 10px;
  background: var(--ink);
  transform: rotate(45deg);
}


/* ─── 4. YEAR FILTER BAR (sticky) ───────────────────────────── */
.filterbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--hairline);
  margin-top: 40px;
}

.filterbar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.filter-cap {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin-right: 2px;
}

.yr-btns {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.yr-btn {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 7px 15px;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--hover-dur) var(--ease-soft),
              color var(--hover-dur) var(--ease-soft),
              border-color var(--hover-dur) var(--ease-soft);
}

.yr-btn .n { font-family: var(--serif); }
.yr-btn:hover { background: var(--paper-2); color: var(--ink); }
.yr-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.yr-btn.active:hover { background: var(--ink); color: var(--paper); }


/* ─── 5. TIMELINE / LOGBOOK ──────────────────────────────────── */
.log { padding: 8px 0; position: relative; }

.year-group { position: relative; }

/* Spine segment per year-group — hidden years take their spine with them */
.year-group::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 30px;
  bottom: 0;
  width: 1px;
  background: var(--hairline);
}

.year-group:last-child::before { bottom: 34px; }

/* Year heading */
.year-head {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 18px;
  padding: 52px 0 26px;
  position: relative;
}

.year-head .node {
  justify-self: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--kaki);
  box-shadow: 0 0 0 5px var(--paper);
}

.year-head .yh-text {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.year-head .yr {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  color: var(--ink);
  line-height: 1;
  letter-spacing: .5px;
}

.year-head .yr .suffix {
  font-size: 15px;
  color: var(--ink-3);
  margin-left: 1px;
}

.year-head .yh-en {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-3);
  text-transform: uppercase;
}

.year-head .yh-en .c {
  font-family: var(--serif);
  color: var(--ink-2);
  margin: 0 2px;
}

/* Entry card */
.entry {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 18px;
  padding: 30px 24px 30px 0;
  border-bottom: 1px solid var(--hairline-2);
  position: relative;
  border-radius: 8px;
  transition: background var(--hover-dur) var(--ease-soft);
}

.entry:hover { background: var(--paper-2); }

.entry .node {
  justify-self: center;
  margin-top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 4px var(--paper);
}

.entry:hover .node { box-shadow: 0 0 0 4px var(--paper-2); }

.entry-main { min-width: 0; }

.entry-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.entry-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink);
  letter-spacing: .3px;
  margin: 0;
  text-wrap: pretty;
}

/* 種別 badge */
.badge {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .8px;
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-block;
  background: var(--c-soft);
  color: var(--c);
  transform: translateY(-2px);
}

/* Date strip */
.entry-dates {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.daterange {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  letter-spacing: .5px;
  white-space: nowrap;
}

.daterange .arrow { color: var(--ink-3); font-family: var(--sans); }
.daterange .ongoing { color: var(--ink-3); }

.dur {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
}

.entry:hover .dur { background: var(--paper); border-color: var(--hairline); }
.dur .v { font-family: var(--serif); font-size: 12.5px; color: var(--ink); margin-right: 1px; }
.dur .lbl { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-3); margin-right: 3px; }

.entry-sum {
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-2);
  margin: 0 0 13px;
  max-width: 660px;
  font-feature-settings: "palt";
}

.entry-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--kaki);
  font-weight: 500;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 540ms var(--ease-soft), color var(--hover-dur) var(--ease-soft);
}

.entry-link:hover { background-size: 100% 1px; }
.entry-link svg { flex-shrink: 0; opacity: .8; }

/* Empty state (safety) */
.no-result {
  display: none;
  padding: 64px 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}


/* ─── 6. FOOTER NOTE ─────────────────────────────────────────── */
.foot-note {
  margin-top: 40px;
  padding: 28px 0 4px;
  border-top: 1px solid var(--hairline);
}

.foot-note .fn-block {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  padding: 16px 0;
  align-items: start;
}

.foot-note .fn-block + .fn-block {
  border-top: 1px dashed var(--hairline-2);
}

.foot-note h4 {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  line-height: 1.5;
}

.foot-note p {
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-2);
  margin: 0;
  max-width: 660px;
}

.foot-note a {
  color: var(--kaki);
  background-image: linear-gradient(var(--kaki-soft), var(--kaki-soft));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-color var(--hover-dur) var(--ease-soft);
}

.foot-note a:hover {
  background-image: linear-gradient(var(--kaki), var(--kaki));
}


/* ─── 7. RESPONSIVE ──────────────────────────────────────────── */
/* bp-md: 880px */
@media (max-width: 880px) {
  .page-h1 { font-size: 32px; }
  .wrap-mid { padding: 0 22px; }
  .year-group::before { left: 18px; }
  .year-head { grid-template-columns: 36px 1fr; gap: 14px; padding: 30px 0 12px; }
  .year-head .yr { font-size: 26px; }
  .entry { grid-template-columns: 36px 1fr; gap: 14px; padding: 20px 0; }
  .entry-name { font-size: 17px; }
  .daterange { font-size: 14px; }
  .foot-note .fn-block { grid-template-columns: 1fr; gap: 8px; }
}

/* bp-sm: 520px */
@media (max-width: 520px) {
  .daterange { gap: 7px; }
  .entry-dates { gap: 9px; }
  .filterbar-inner { gap: 10px; }
}


/* ─── 8. MOTION ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .page-head .kicker,
  .page-head .page-h1,
  .page-head .page-dek,
  .page-head .page-stats {
    opacity: 0;
    transform: translateY(6px);
    animation: au-revealUp var(--rev-dur) var(--ease-soft) forwards;
  }

  .page-head .kicker      { animation-delay: 40ms;  }
  .page-head .page-h1     { animation-delay: 120ms; }
  .page-head .page-dek    { animation-delay: 260ms; }
  .page-head .page-stats  { animation-delay: 400ms; }

  [data-reveal] {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--rev-dur) var(--ease-soft),
                transform var(--rev-dur) var(--ease-soft);
  }

  [data-reveal].is-in {
    opacity: 1;
    transform: translateY(0);
  }

  /* Fade on year filter switch */
  .filtering .entry,
  .filtering .year-head { transition: opacity 220ms var(--ease-soft); }
  .filtering .log { opacity: 0; }
  .log { transition: opacity 260ms var(--ease-soft); }
}

@keyframes au-revealUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
