/* ============================================================
   TOTEKAWA — through the lens | stylesheet
   Cascade Layers + OKLCH tokens + BEM naming
   layer order: reset < tokens < base < layout < components < utilities
   state classes: .is-* (JSが付与), 構造: block__element--modifier
   ============================================================ */
@layer reset, tokens, base, layout, components, utilities;

/* ---------- reset ---------- */
@layer reset {
  * { margin: 0; padding: 0; box-sizing: border-box; }
}

/* ---------- tokens (OKLCH) ---------- */
@layer tokens {
  :root {
    /* neutrals — blue-gray, hue ~266 で統一 */
    --bg:         oklch(0.200 0.009 266);
    --surface:    oklch(0.239 0.014 266);
    --line:       oklch(0.297 0.013 266);
    --text:       oklch(0.946 0.012 92);   /* warm off-white */
    --text-sub:   oklch(0.643 0.011 266);
    --text-mute:  oklch(0.829 0.011 262);  /* nav link */
    --text-faint: oklch(0.763 0.012 265);  /* archive link */
    --text-dim:   oklch(0.607 0.015 266);  /* archive title — コントラストAA(≈4.7:1) */
    --white:      oklch(1 0 0);

    /* accent */
    --accent:     oklch(0.623 0.168 38);   /* terracotta */

    /* surfaces / overlays */
    --band-bg:    oklch(0.231 0.016 266);
    --band-line:  oklch(0.309 0.023 266);
    --shade:      oklch(0.150 0.007 266);  /* near-black overlay */
    --backdrop:   oklch(0.139 0.005 266);  /* lightbox backdrop */
    --panel:      oklch(0.174 0.008 266);  /* caption panel */

    /* brand gradient */
    --brand-1:    oklch(0.967 0.011 90);
    --brand-2:    oklch(0.829 0.061 339);
    --brand-3:    oklch(0.727 0.118 289);

    /* about-band glows */
    --glow-purple: oklch(0.565 0.168 294);
    --glow-blue:   oklch(0.582 0.156 263);
    --glow-pink:   oklch(0.636 0.160 7);
  }
}

/* ---------- base ---------- */
@layer base {
  html {
    scroll-behavior: smooth;
    scrollbar-width: thin;                       /* Firefox: 細身 */
    scrollbar-color: var(--line) transparent;    /* Firefox: つまみ / 溝 */
    scrollbar-gutter: stable;                    /* スクロールバー分の隙間を常に確保し、出現/消失で幅が変わって列数がズレるのを防ぐ */
  }

  /* WebKit系(Chrome/Safari/Edge): ダークテーマに馴染む細めスクロールバー */
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--line);
    border: 3px solid transparent;   /* 透明ボーダー+padding-boxでつまみを細く見せる */
    background-clip: padding-box;
    border-radius: 999px;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-sub); background-clip: padding-box; }
  ::-webkit-scrollbar-corner { background: transparent; }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", system-ui, sans-serif;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
  }

  img { display: block; max-width: 100%; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- layout ---------- */
@layer layout {
  /* home sections */
  .section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 72px 24px;
  }

  .entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
  }

  /* gallery page shell */
  .page-head {
    padding: 130px 24px 10px;
    max-width: 1260px;
    margin: 0 auto;
  }

  .gallery-wrap {
    max-width: 1260px;
    margin: 0 auto;
    padding: 10px 24px 80px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
  }

  .gallery-wrap__main { flex: 1; min-width: 0; }

  /* sidebar filter */
  .tag-bar {
    position: sticky;
    top: 92px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 202px;
    flex: none;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    margin-top: 30px;
    padding: 4px;
  }

  .tag-bar__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .tag-bar__toggle { display: none; }

  .month-nav {
    flex-basis: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  /* month archive grid */
  .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    grid-auto-flow: dense;
    gap: 12px;
  }

  .gallery__item {
    margin: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    cursor: zoom-in;
    aspect-ratio: 3 / 4;
  }

  /* 横長写真: 2列分の横長タイル(ビルドが自動判定して --wide を付与) */
  .gallery__item--wide {
    grid-column: span 2;
    aspect-ratio: 3 / 2;
  }

  .gallery__item--featured:not(.gallery__item--wide) {
    grid-column: span 2;
    grid-row: span 2;
  }

  /* 絞り込み中はJSマソンリー(main.jsが絶対配置で最短列へ)。各写真を本来の比率のまま、縦横混在でも隙間なく積む */
  .gallery.is-filtering {
    display: block;
    position: relative;
  }
  .gallery.is-filtering .gallery__item {
    position: absolute;
    margin: 0;
    opacity: 1;        /* reveal入場アニメを無効化(絶対配置と干渉させない) */
    transform: none;
    /* width / height / left / top は main.js が設定 */
  }

  @media (max-width: 560px) {
    /* 1列表示のときは折返し不能なspanを解除し、横長比率だけ維持 */
    .gallery__item--wide { grid-column: auto; aspect-ratio: 3 / 2; }
    /* 大タイル(featured)のspanも解除。1列幅では暗黙の2列目が生まれてタイルが極端に小さくなるため */
    .gallery__item--featured:not(.gallery__item--wide) { grid-column: auto; grid-row: auto; }
  }

  @media (max-width: 900px) {
    .gallery-wrap { display: block; }

    .tag-bar {
      position: sticky;
      top: 58px;
      z-index: 50;
      width: auto;
      max-height: none;
      overflow: visible;
      gap: 8px;
      margin: 0 -24px;
      padding: 10px 24px 12px;
      background: oklch(from var(--bg) l c h / 0.92);
      backdrop-filter: blur(8px);
    }

    .tag-bar__toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      background: none;
      border: 1px solid var(--line);
      border-radius: 8px;
      color: var(--text-sub);
      font-size: 13px;
      padding: 9px 14px;
      cursor: pointer;
      width: 100%;
      justify-content: center;
    }

    .tag-bar.is-open .tag-bar__toggle { color: var(--text); border-color: var(--accent); }

    .tag-bar .tag-bar__row, .tag-bar .month-nav {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      max-height: 0;
      opacity: 0;
      overflow: hidden;
      padding: 0 2px;
      margin: 0;
      transform: translateY(-6px);
      transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.35s ease, padding 0.35s ease;
    }

    .tag-bar .tag-bar__row { gap: 10px; }

    .tag-bar.is-open .tag-bar__row {
      max-height: 600px;
      opacity: 1;
      transform: none;
      padding: 8px 2px 2px;
    }

    .tag-bar .month-nav {
      flex-direction: row;
      gap: 6px;
      border-top: 1px solid transparent;
      align-items: center;
      transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.35s ease, padding 0.35s ease, border-color 0.3s ease;
    }

    .tag-bar.is-open .month-nav {
      max-height: 600px;
      opacity: 1;
      transform: none;
      padding: 10px 2px 2px;
      border-top-color: var(--line);
    }

    .page-head { text-align: center; }
  }

  /* about / contact band */
  .band {
    position: relative;
    background:
      radial-gradient(ellipse 90% 130% at 15% 0%, oklch(from var(--glow-purple) l c h / 0.18), transparent 62%),
      radial-gradient(ellipse 80% 110% at 88% 100%, oklch(from var(--glow-blue) l c h / 0.14), transparent 60%),
      radial-gradient(ellipse 60% 90% at 60% 40%, oklch(from var(--glow-pink) l c h / 0.07), transparent 65%),
      var(--band-bg);
    border-top: 1px solid var(--band-line);
    border-bottom: 1px solid var(--band-line);
  }

  .band::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  .band .section { position: relative; z-index: 1; }
}

/* ---------- components ---------- */
@layer components {
  /* header */
  .header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    background: linear-gradient(oklch(from var(--bg) l c h / 0.85), oklch(from var(--bg) l c h / 0));
    transition: background 0.3s;
  }

  .header.is-scrolled {
    background: oklch(from var(--bg) l c h / 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }

  .header__brand {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.18em;
    background: linear-gradient(180deg, var(--brand-1) 25%, var(--brand-2) 70%, var(--brand-3) 105%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  /* nav */
  .nav { display: flex; gap: 22px; font-size: 13.5px; font-weight: 500; }

  .nav a {
    color: var(--text-mute);
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
  }

  .nav a:hover { color: var(--text); }
  .nav a.is-active { color: var(--text); border-color: var(--accent); }

  /* スマホ: ハンバーガー→ドロップダウン(ボタンはmain.jsが生成) */
  .nav__toggle { display: none; background: none; border: none; color: var(--text); font-size: 19px; padding: 6px 10px; cursor: pointer; }

  @media (max-width: 640px) {
    .nav__toggle { display: block; }
    .header .nav {
      display: none;
      position: absolute;
      top: 100%;
      left: 0; right: 0;
      flex-direction: column;
      gap: 0;
      text-align: center;
      background: oklch(from var(--bg) l c h / 0.96);
      backdrop-filter: blur(8px);
      border-bottom: 1px solid var(--line);
      padding: 6px 0 10px;
    }
    .header .nav.is-open { display: flex; animation: navdrop 0.25s ease; }
    .header .nav a { padding: 11px 0; border-bottom: none; }
    .header .nav a.is-active { color: var(--accent); }
  }

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

  /* hero */
  .hero {
    position: relative;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
  }

  .hero__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 2s ease;
  }

  .hero__slide.is-active { opacity: 1; }

  .hero__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* ズーム/パンはJSが付与する状態クラスで発動(.is-activeに紐付けるとフェードアウト時に位置が戻るため) */
  .hero__slide img.is-kb { animation: kenburns 9s ease-out forwards; }

  @keyframes kenburns {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
  }

  /* スマホ縦画面: 横長写真は切り抜き固定でなく、横パンで全体を見せる(方向はJSがランダムに付与) */
  @media (max-width: 900px) and (orientation: portrait) {
    .hero__slide img {
      width: auto;
      min-width: 100%;
      max-width: none; /* グローバルのmax-width:100%を解除しないとパン距離が出ない */
      height: 100%;
    }
    .hero__slide img.is-kb { animation: none; }
    /* ↓この「13s」がパンの移動時間。大きくするとゆっくりに(main.jsの13000と同じ値にすると端に着いた瞬間に切替) */
    .hero__slide img.is-pan-ltr { animation: heropan 13s ease-in-out forwards; }
    .hero__slide img.is-pan-rtl { animation: heropan-rev 13s ease-in-out forwards; }
  }

  @keyframes heropan {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-100% + 100vw)); }
  }

  @keyframes heropan-rev {
    from { transform: translateX(calc(-100% + 100vw)); }
    to { transform: translateX(0); }
  }

  @media (max-width: 900px) and (orientation: portrait) and (prefers-reduced-motion: reduce) {
    .hero__slide.is-active img {
      animation: none;
      transform: translateX(calc((-100% + 100vw) / 2)); /* 中央を静止表示 */
    }
  }

  .hero__shade {
    position: absolute;
    inset: 0;
    background: oklch(from var(--shade) l c h / 0.32);
  }

  .hero__copy {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;
  }

  .hero__copy h1 {
    font-size: clamp(34px, 7vw, 64px);
    font-weight: 500;
    letter-spacing: 0.22em;
    text-shadow: 0 2px 24px oklch(0 0 0 / 0.45);
  }

  .hero__copy p {
    margin-top: 10px;
    font-size: clamp(11px, 1.6vw, 14px);
    letter-spacing: 0.34em;
    color: oklch(from var(--text) l c h / 0.85);
  }

  .hero__scroll {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    color: oklch(from var(--text) l c h / 0.75);
    font-size: 18px;
    animation: bob 2.2s ease-in-out infinite;
  }

  @keyframes bob {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 8px); }
  }

  /* section headings */
  .section__title {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
  }

  .section__sub {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 34px;
  }

  /* works entry cards */
  .entry-card {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface);
  }

  .entry-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 22%; /* 首切れ防止で上寄り */
    transition: transform 0.5s ease;
  }

  .entry-card:hover img { transform: scale(1.06); }

  .entry-card__label {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 30px 16px 14px;
    background: linear-gradient(oklch(from var(--shade) l c h / 0), oklch(from var(--shade) l c h / 0.8));
    font-size: 15px;
    letter-spacing: 0.1em;
  }

  .entry-card__label span {
    display: block;
    font-size: 11px;
    color: var(--text-sub);
    letter-spacing: 0.06em;
  }

  /* gallery page heading */
  .page-head h1 {
    font-size: 26px;
    font-weight: 500;
    letter-spacing: 0.12em;
  }

  .page-head p { font-size: 13px; color: var(--text-sub); margin-top: 4px; }

  /* tag filter buttons */
  .tag {
    text-align: left;
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-sub);
    font-size: 12px;
    padding: 6px 14px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
  }

  .tag:hover { color: var(--text); }
  .tag.is-active { border-color: var(--accent); color: var(--text); }

  .tag--all {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    padding: 0;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.04em;
  }

  .tag--all.is-active { background: var(--accent); border-color: var(--accent); color: var(--white); }

  .tag--avatar {
    padding: 0;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    overflow: hidden;
    flex: none;
    opacity: 0.85;
    transition: opacity 0.2s, box-shadow 0.2s;
  }

  .tag--avatar span { display: none; }

  .tag--avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  .tag--avatar:hover { opacity: 1; }
  .tag--avatar.is-active { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }

  @media (max-width: 900px) {
    .tag { white-space: nowrap; flex: none; }
  }

  /* character name tooltip */
  .char-tip {
    position: fixed;
    z-index: 300;
    transform: translate(-50%, -100%);
    background: oklch(from var(--shade) l c h / 0.92);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
  }

  .char-tip.is-shown { opacity: 1; }

  /* month archive nav */
  .month-nav__title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--text-dim);
    padding: 0 8px 5px;
    text-transform: uppercase;
  }

  .month-nav a {
    font-size: 12.5px;
    color: var(--text-faint);
    padding: 5px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
  }

  .month-nav a:hover { color: var(--text); background: oklch(from var(--text) l c h / 0.06); }

  @media (max-width: 900px) {
    .month-nav a { white-space: nowrap; flex: none; }
    .month-nav__title { flex-basis: 100%; padding: 0 0 2px; text-align: center; }
  }

  .month-title {
    scroll-margin-top: 92px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-sub);
    margin: 30px 0 12px;
    padding-left: 10px;
    border-left: 3px solid var(--accent);
  }

  .gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 22%; /* 頭が上にある構図が多いため上寄りでトリミング */
    transition: transform 0.4s ease, opacity 0.4s;
  }
  .gallery__item:hover img { transform: scale(1.03); opacity: 0.92; }

  /* lightbox */
  .lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    background: oklch(from var(--backdrop) l c h / 0.96);
    touch-action: none; /* ズーム/スワイプはJSで制御(ブラウザ標準ジェスチャは抑止) */
  }

  .lightbox.is-open {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 46px 0 30px;
  }

  .lightbox img {
    max-width: 92vw;
    max-height: 80vh;
    object-fit: contain;
    transition: opacity 0.25s;
    transform-origin: 0 0;   /* JSのズーム計算(左上基準)と一致させる */
    touch-action: none;
    cursor: zoom-in;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none; /* PCで画像を掴んでパンする際、標準の画像ドラッグを抑止 */
  }

  .lightbox img.is-zoomed { cursor: grab; }
  .lightbox img.is-panning { cursor: grabbing; }
  .lightbox img.is-animating { transition: transform 0.22s ease, opacity 0.25s; }

  .lightbox__caption {
    max-width: min(640px, 86vw);
    text-align: center;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    background: oklch(from var(--panel) l c h / 0.78);
    backdrop-filter: blur(6px);
    border: 1px solid oklch(from var(--text) l c h / 0.1);
    border-radius: 10px;
    padding: 10px 18px;
    transition: opacity 0.25s ease;
  }

  .lightbox__caption:empty { display: none; }

  /* 拡大中はキャプションが写真の邪魔にならないようフェードアウト */
  .lightbox.is-zoomed .lightbox__caption { opacity: 0; pointer-events: none; }

  .lightbox__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2; /* 画像(will-change:transformで合成レイヤー化)より前面に。左矢印が裏に潜る対策 */
    background: none;
    border: none;
    color: oklch(from var(--text) l c h / 0.8);
    font-size: 26px;
    cursor: pointer;
    padding: 20px;
  }

  .lightbox__btn:hover { color: var(--text); }
  .lightbox__btn--prev { left: 6px; }
  .lightbox__btn--next { right: 6px; }

  .lightbox__close {
    position: absolute;
    top: 14px;
    right: 18px;
    z-index: 2; /* 同上: 画像の前面に */
    background: none;
    border: none;
    color: oklch(from var(--text) l c h / 0.8);
    font-size: 24px;
    cursor: pointer;
  }

  .lightbox__btn i, .lightbox__close i { pointer-events: none; }

  /* about */
  .about__avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 18px;
    border: 2px solid oklch(from var(--text) l c h / 0.25);
    box-shadow: 0 0 0 6px oklch(from var(--text) l c h / 0.05);
  }

  .about__body { max-width: 720px; }
  .about__body p { margin-bottom: 1em; color: var(--text); }

  .about__en {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid oklch(from var(--text) l c h / 0.12);
  }

  .about__en p {
    font-size: 13px;
    color: var(--text-sub);
    letter-spacing: 0.04em;
    margin-bottom: 0.6em;
  }

  /* contact links */
  .link-list { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; }

  .link-list a {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 13px;
    color: var(--text-sub);
    transition: border-color 0.2s, color 0.2s;
  }

  .link-list a:hover { border-color: var(--accent); color: var(--text); }
  .link-list a i { margin-right: 7px; font-size: 14px; }

  .notice {
    margin-top: 34px;
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.9;
  }

  /* to-top button */
  .to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 150;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: oklch(from var(--surface) l c h / 0.9);
    backdrop-filter: blur(6px);
    color: var(--text-sub);
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s, color 0.2s, border-color 0.2s;
  }

  .to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
  .to-top:hover { color: var(--text); border-color: var(--accent); }

  /* footer */
  .footer {
    border-top: 1px solid var(--line);
    padding: 26px 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-sub);
    letter-spacing: 0.06em;
  }

  .footer a {
    color: var(--text-sub);
    border-bottom: 1px solid var(--line);
    transition: color 0.2s, border-color 0.2s;
  }
  .footer a:hover { color: var(--text); border-color: var(--accent); }
}

/* ---------- utilities ---------- */
@layer utilities {
  .section--center { text-align: center; }
  .section--center .about__body { margin: 0 auto; }
  .section--center .link-list { justify-content: center; }

  /* hero loading spinner */
  .hero.is-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid oklch(from var(--text) l c h / 0.2);
    border-top-color: oklch(from var(--text) l c h / 0.85);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    z-index: 5;
  }

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

  /* thumbnail load-in + skeleton shimmer */
  .gallery img, .entry-card img { opacity: 0; }
  .gallery img.is-loaded, .entry-card img.is-loaded { opacity: 1; }

  .gallery__item, .entry-card {
    background:
      linear-gradient(100deg, transparent 30%, oklch(from var(--text) l c h / 0.05) 50%, transparent 70%)
      var(--surface);
    background-size: 220% 100%;
    animation: shimmer 1.6s ease infinite;
  }

  @keyframes shimmer {
    from { background-position: 130% 0; }
    to { background-position: -90% 0; }
  }

  /* scroll reveal */
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
  .reveal.is-revealed { opacity: 1; transform: none; }

  /* lightbox spinner */
  .lightbox__spinner { display: none; }

  .lightbox.is-loading .lightbox__spinner {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 3px solid oklch(from var(--text) l c h / 0.2);
    border-top-color: oklch(from var(--text) l c h / 0.85);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
  }

  .lightbox.is-loading img { opacity: 0.15; }

  @media (prefers-reduced-motion: reduce) {
    .hero__slide.is-active img { animation: none; }
    .gallery__item, .entry-card { animation: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
  }
}
