/* =========================
   Okawara Kenta - style.css
   FINAL (Single Source / Stable / Full Restore)
========================= */

/* ===== Base / Reset ===== */
:root{
  --pad: 40px;
  --pad-sm: 16px;
  --nav-gap: 28px;
  --nav-bg: rgba(255,255,255,0.95);
  --nav-border: rgba(0,0,0,0.25);
  --text-muted: rgba(0,0,0,0.58);
}

html, body{ margin: 0; padding: 0; }
*{ box-sizing: border-box; }

body{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Helvetica, Arial, "Hiragino Kaku Gothic ProN",
               "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: #000;
  background: #fff;
}

a{ color: inherit; }

/* ===== Main layout ===== */
main{
  padding: 0 var(--pad);
  padding-bottom: 120px; /* bottom-nav clearance */
}

/* ===== Page Title ===== */
.section > h2{
  margin: 0;
  padding-top: 28px;
  font-size: 14px;
  font-weight: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* =========================
   TOP: Fullscreen Slideshow
========================= */
.hero{
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.slides{
  position: absolute;
  inset: 0;
  z-index: 1;
}

.slide{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.slide.is-active{ opacity: 1; }

.top-title{
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 10;
  background: rgba(255,255,255,0.9);
  padding: 4px 8px;
  font-size: 44px;
  line-height: 1;
  letter-spacing: 0.01em;
  pointer-events: none;
}

/* =========================
   Right-top language switch
========================= */
.lang-switch{
  position: fixed;
  top: 25px;
  right: 40px;
  font-size: 13px;
  z-index: 10000;
  text-align: right;

  background: rgba(255,255,255,0.85);
  padding: 6px 10px;
  border-radius: 999px;
}

.lang-switch a{
  text-decoration: none;
  opacity: 0.6;
}
.lang-switch a.active{
  opacity: 1;
  pointer-events: none;
}

/* contactだけ言語スイッチを消す（2段構え：安全） */
.contact-page .lang-switch{ display: none !important; }
/* :has() が使えるブラウザでは、contact section があれば消す（誤爆しにくい） */
body:has(.section.contact) .lang-switch{ display: none !important; }

/* notch / safe-area */
@supports (top: env(safe-area-inset-top)){
  .lang-switch{
    top: calc(14px + env(safe-area-inset-top));
    right: calc(16px + env(safe-area-inset-right));
  }
}

/* =========================
   Bottom Navigation Bar
========================= */
.bottom-nav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;

  background: var(--nav-bg);
  border-top: 2px solid var(--nav-border);

  display: flex;
  align-items: center;
  gap: var(--nav-gap);
  padding: 10px 14px;
  white-space: nowrap;
}

.bottom-nav a{
  display: inline-block;
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.06em;

  color: rgba(0,0,0,0.7);
  transition: color 0.2s ease, opacity 0.2s ease;
}
.bottom-nav a:hover{ color: rgba(0,0,0,0.5); }

.bottom-nav a.active{
  pointer-events: none;
  opacity: 0.4;
}

/* WORKS page only */
.works-page .bottom-nav a{ color: #bbb; }
.works-page .bottom-nav a.active{ color: #000; opacity: 1; }
.works-page .bottom-nav a:not(.active):hover{ color: #000; }

/* =========================
   WORKS
========================= */
.works-filter{
  display: flex;
  gap: 16px;
  margin: 0 0 28px;
  padding: 28px 0 0;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.works-filter li{ list-style: none; margin: 0; padding: 0; }
.works-filter a{ text-decoration: none; color: #999; }
.works-filter a.active{ color: #000; text-decoration: underline; }

.works-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.work-item{
  display: block;
  text-decoration: none;
  color: inherit;
}

.work-item img{
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform .22s ease, filter .22s ease;
}

.caption-grid{
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.7;
  color: #111;
  text-align: center;
  transition: opacity .2s ease, color .2s ease;
}

.work-item:hover img{
  transform: scale(1.01);
  filter: contrast(1.03);
}
.work-item:hover .caption-grid{ opacity: .45; }

/* Archive item */
.archive-link{
  border: none;
  background: rgba(0,0,0,0.09);
  padding: 40px 20px;
  text-align: center;
  text-decoration: none;
}
.archive-link:hover{ background: rgba(0,0,0,0.05); }

.archive-caption{
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: rgba(0,0,0,0.75);
}

/* =========================
   NEWS
========================= */
.section.news{
  max-width: 640px;
  margin: 0 auto;
}
.section.news h2{ margin-bottom: 24px; }

.news-item{
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 10px;
  color: var(--text-muted);
}
.news-date{
  width: 92px;
  flex-shrink: 0;
  color: rgba(0,0,0,0.6);
}
.news-body{ flex: 1; }

/* =========================
   TEXTS
   - Base typography only (NO max-width tricks here)
   - Line breaks are controlled ONLY by <br> (see final override at bottom)
========================= */
.section.texts{
  max-width: 640px;
  margin: 0 auto;
}

.section.texts .text-block p{
  font-size: 14px;
  line-height: 1.7;
  margin: 0 0 1.4em;
  color: var(--text-muted);
}

html[lang="ja"] .section.texts .text-block p{
  font-size: 10px;
  line-height: 2.5;
}

/* =========================
   CV
========================= */
.section.cv{
  max-width: 640px;
  margin: 0 auto;
}
.section.cv > h2{ margin-bottom: 40px; }

.section.cv p{
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 18px;
  color: var(--text-muted);
}
html[lang="ja"] .section.cv p{ font-size: 12px; }

.section.cv h3{
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: rgba(0,0,0,0.8);
  margin: 32px 0 14px;
}

.section.cv .cv-name{
  font-size: 20px;
  letter-spacing: 0.06em;
  color: rgba(0,0,0,0.9);
}

/* =========================
   CONTACT
========================= */
.section.contact{
  max-width: 640px;
  margin: 0 auto;
}
.section.contact h2{ margin-bottom: 40px; }

.section.contact p{
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* =========================
   TOP: Latest NEWS peek
========================= */
.news-peek{
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 240px;
  padding: 12px 12px 10px;
  background: rgba(255,255,255,0.70);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 0;
  z-index: 999;
}

.news-peek__label{
  font-size: 11px;
  letter-spacing: 0.12em;
  opacity: 0.7;
  margin-bottom: 6px;
}
.news-peek__title{
  display: block;
  text-decoration: none;
  color: inherit;
  font-size: 13px;
  line-height: 1.25;
}
.news-peek__date{
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.6;
}

/* =========================
   LIGHTBOX (ID based: matches your works.html)
========================= */
#lightbox{
  position: fixed;
  inset: 0;
  background: #fff;
  display: none;
  place-items: center;
  z-index: 9999;
  padding: 24px;
  touch-action: pan-y;
}
#lightbox.is-open{ display: grid; }

.lightbox-figure{
  margin: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
}

#lightboxImg{
  max-width: min(800px, 90vw);
  max-height: 82vh;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  transition: opacity 180ms ease;
  will-change: opacity;
}

#lightboxCap{
  font-size: 12px;
  color: rgba(0,0,0,.6);
  text-align: center;
}

/* Controls */
#lightboxClose,
#lightboxPrev,
#lightboxNext{
  position: fixed;
  z-index: 100000;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  color: #000;
  font-size: 28px;
  line-height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#lightboxClose{
  top: calc(14px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
}
#lightboxClose::before{ content: "×"; }

#lightboxPrev,
#lightboxNext{
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.75);
}

#lightboxPrev{
  left: calc(10px + env(safe-area-inset-left));
}
#lightboxPrev::before{ content: "‹"; }

#lightboxNext{
  right: calc(10px + env(safe-area-inset-right));
}
#lightboxNext::before{ content: "›"; }

/* =========================
   Smartphone
========================= */
@media (max-width: 768px){
  main{
    padding: 0 var(--pad-sm);
    padding-bottom: 140px;
  }

  .bottom-nav{
    flex-wrap: wrap;
    white-space: normal;
    gap: 6px 12px;
    padding: 8px 10px;
  }

  .bottom-nav a{
    font-size: 14px;
    padding: 8px 0;
    white-space: nowrap;
  }

  .works-filter{
    padding-top: 18px;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .works-grid{ display: block; }
  .work-item{ margin-bottom: 40px; }

  .work-item img{
    width: 100%;
    max-width: 520px;
    height: auto;
    margin: 0 auto;
    aspect-ratio: auto;
    object-fit: contain;
  }

  .caption-grid{
    font-size: 13px;
    opacity: 0.75;
  }

  #lightbox{ padding: 16px; }
  #lightboxImg{ max-width: 92vw; max-height: 78vh; }

  .news-peek{ display: none; }
}

/* =========================
   RESTORE PATCH (UI rollback)
========================= */

/* ① Lightbox controls : thin & minimal */
#lightboxClose,
#lightboxPrev,
#lightboxNext{
  background: transparent;
  font-size: 0;
}

#lightboxClose::before,
#lightboxClose::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:18px;
  height:1px;
  background: rgba(0,0,0,0.6);
}

#lightboxClose::before{ transform: translate(-50%,-50%) rotate(45deg); }
#lightboxClose::after { transform: translate(-50%,-50%) rotate(-45deg); }

#lightboxPrev::before,
#lightboxNext::before{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:12px;
  height:12px;
  border-left:1px solid rgba(0,0,0,0.6);
  border-bottom:1px solid rgba(0,0,0,0.6);
}

#lightboxPrev::before{ transform: translate(-35%,-50%) rotate(45deg); }
#lightboxNext::before{ transform: translate(-65%,-50%) rotate(-135deg); }

/* ② CV / TEXTS / NEWS : left aligned */
.section.cv,
.section.texts,
.section.news{
  margin-left: 0;
  margin-right: 0;
}

/* ③ TEXTS line spacing = CV */
.section.texts .text-block p{
  line-height: 1.8;
}
/* TEXTS title → body spacing restore */
.section.texts h2,
.section.contact h2{
  margin-bottom: 40px;
}

/* Lightbox arrows: stick close to image */
.lightbox-figure{
  position: relative;
}

#lightboxPrev,
#lightboxNext{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

#lightboxPrev{ left: -56px; }
#lightboxNext{ right: -56px; }

/* CONTACT：TEXTSと同じ箱で、間隔だけ調整 */
.contact-page .contact-links{
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* =========================
   CONTACT final fix (safe)
========================= */
.section.contact{
  margin-left: 0;
  margin-right: 0;
}

.section.contact > h1{
  margin: 0;
  padding-top: 28px;
  font-size: 14px;
  font-weight: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section.contact > h2{ margin-bottom: 40px; }

.section.contact .contact-links{
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.section.contact .contact-links a{ text-decoration: underline; }

.section.contact{ padding-left: 40px; }

.section.contact a,
.section.contact .contact-email{
  font-size: 12px;
  color: rgba(0,0,0,0.45);
}

.section.contact .contact-note,
.section.contact .contact-email{
  font-size: 12px;
  color: rgba(0,0,0,0.45);
  line-height: 1.4;
}

.section.contact .contact-note{
  display: inline-block;
  margin-bottom: -40px;
}

/* FINAL OVERRIDE: CONTACT MUST BE LEFT */
.section.contact{
  margin-left: 0 !important;
  margin-right: 0 !important;
}


.works-page .site-footer{
  position: relative;
  margin-top: 80px;

  /* bottom-nav と被らない最低限の余白 */
  padding: 0 0 140px;      /* ← %は禁止。px固定 */

  /* 位置調整 */
  transform: translateX(50px);  /* ← ここだけ触る */

  /* 見た目を固定 */
  font-size: 11px;
  color: rgba(0,0,0,0.45);
  font-weight: normal;
  text-align: left;
  letter-spacing: 0.04em;
}
.texts-page .site-footer{
  display: none;
}
