/**
 * Atlas index — 構造目録型トップ（Phase 1）
 * Frame / Brace / Surface inspired structural grid (not bento / margin-0)
 */
@import url("site-tokens.css?v=1");

:root {
  --at-bg: var(--site-bg);
  --at-paper: var(--site-paper);
  --at-ink: var(--site-ink);
  --at-muted: var(--site-muted);
  --at-line: var(--site-line);
  --at-line-strong: var(--site-line-strong);
  --at-accent: var(--site-accent);
  --at-rail-w: 168px;
  --at-pad: clamp(16px, 3vw, 40px);
  --at-sheet-pad: clamp(20px, 4vw, 48px);
  --at-cols: 12;
  --at-gap: 0;
  --at-font-en: 'Cormorant Garamond', Georgia, serif;
  --at-font-body: 'Jost', system-ui, sans-serif;
  --at-font-jp: 'Shippori Mincho', 'Yu Mincho', serif;
  --at-font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --at-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-height: 56px;
}

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

html {
  margin: 0;
  scroll-behavior: smooth;
}

body.atlas-page {
  margin: 0;
  background: var(--at-bg) !important;
  color: var(--at-ink);
  font-family: var(--at-font-body);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* subtle structural grid — logo geometry */
body.atlas-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(90deg, transparent calc(100% - 1px), color-mix(in srgb, var(--at-line) 55%, transparent) calc(100% - 1px)),
    linear-gradient(0deg, transparent calc(100% - 1px), color-mix(in srgb, var(--at-line) 55%, transparent) calc(100% - 1px));
  background-size: calc(100% / 12) calc(100% / 12);
}

.atlas-page > * {
  position: relative;
  z-index: 1;
}

.at-chip {
  position: fixed;
  top: calc(var(--nav-height) + 6px);
  right: 10px;
  z-index: 9999;
  margin: 0;
  padding: 4px 10px;
  font-family: var(--at-font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--at-muted);
  background: color-mix(in srgb, var(--at-paper) 90%, transparent);
  border: 1px solid var(--at-line);
  pointer-events: none;
}

/* #site-nav の見た目は site-nav.css に一本化（トップも他ページと同一） */

.at-end {
  display: none;
  border: none;
  margin: 0;
}

/* —— Sheet wrapper (drawing margin) —— */
.at-sheet {
  max-width: 1440px;
  margin: 0 auto;
  background: var(--at-paper);
  border-left: 1px solid var(--at-line);
  border-right: 1px solid var(--at-line);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--at-line) 40%, transparent);
  overflow-x: clip;
}

/* —— Hero carousel —— */
.at-hero {
  border-bottom: 1px solid var(--at-line-strong);
}

.at-hero__frame {
  position: relative;
  margin: var(--at-sheet-pad);
  border: 1px solid var(--at-line-strong);
  background: #e8e4dc;
  overflow: hidden;
}

.at-hero__slides {
  position: relative;
  aspect-ratio: 2560 / 800;
  max-height: min(52vh, 520px);
}

.at-hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s var(--at-ease);
}

.at-hero__slide.is-active {
  opacity: 1;
  z-index: 1;
}

.at-hero__slide a,
.at-hero__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.at-hero__meta {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--at-paper) 88%, transparent);
  border-top: 1px solid var(--at-line-strong);
  border-right: 1px solid var(--at-line-strong);
  font-family: var(--at-font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.at-hero__code {
  margin: 0;
  color: var(--at-ink);
  font-weight: 400;
}

.at-hero__view {
  margin: 0;
  color: var(--at-muted);
}

.at-hero__ctrl {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--at-paper) 70%, transparent);
  background: color-mix(in srgb, var(--at-ink) 12%, transparent);
  color: var(--at-paper);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.at-hero__ctrl:hover {
  background: color-mix(in srgb, var(--at-ink) 28%, transparent);
}

.at-hero__ctrl--prev {
  left: 12px;
}

.at-hero__ctrl--next {
  right: 12px;
}

.at-hero__dots {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  gap: 6px;
}

.at-hero__dot {
  width: 24px;
  height: 2px;
  padding: 0;
  border: none;
  background: color-mix(in srgb, var(--at-paper) 45%, transparent);
  cursor: pointer;
  transition: background 0.2s, width 0.2s;
}

.at-hero__dot.is-active {
  width: 36px;
  background: var(--at-paper);
}

.at-hero__titleblock {
  padding: clamp(28px, 5vw, 48px) var(--at-sheet-pad);
  text-align: center;
  border-bottom: 1px solid var(--at-line);
}

.at-hero__titleblock h1 {
  margin: 0 0 10px;
  font-family: var(--at-font-en);
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 300;
  letter-spacing: 0.14em;
}

.at-hero__dek {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--at-muted);
}

.at-hero__dek span {
  color: var(--at-ink);
}

/* —— Body: rail + content —— */
.at-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

@media (min-width: 960px) {
  .at-body {
    grid-template-columns: var(--at-rail-w) minmax(0, 1fr);
  }
}

/* —— Section rail —— */
.at-rail {
  border-bottom: 1px solid var(--at-line);
  min-width: 0;
}

@media (min-width: 960px) {
  .at-rail {
    position: sticky;
    top: var(--nav-height);
    align-self: start;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    border-bottom: none;
    border-right: 1px solid var(--at-line);
  }
}

.at-rail__label {
  display: none;
}

@media (max-width: 959px) {
  .at-rail {
    max-width: 100%;
    overflow: hidden;
  }
}

.at-rail__nav {
  display: flex;
  flex-direction: row;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.at-rail__nav::-webkit-scrollbar {
  display: none;
}

@media (min-width: 960px) {
  .at-rail__nav {
    flex-direction: column;
    overflow: visible;
  }
}

.at-rail__link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 12px var(--at-pad);
  border-bottom: 1px solid var(--at-line);
  color: var(--at-muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

@media (min-width: 960px) {
  .at-rail__link {
    border-bottom: 1px solid var(--at-line);
  }
}

.at-rail__link:hover {
  color: var(--at-ink);
  background: color-mix(in srgb, var(--at-bg) 60%, transparent);
}

.at-rail__link.is-current {
  color: var(--at-ink);
  background: var(--at-bg);
  box-shadow: inset 3px 0 0 var(--at-accent);
}

.at-rail__link.is-soon {
  opacity: 0.45;
  pointer-events: none;
}

.at-rail__num {
  font-family: var(--at-font-mono);
  font-size: 9px;
  color: var(--at-line-strong);
}

.at-rail__link.is-current .at-rail__num {
  color: var(--at-accent);
}

.at-rail__ja {
  display: none;
  font-family: var(--at-font-jp);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--at-muted);
}

@media (min-width: 960px) {
  .at-rail__link {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .at-rail__ja {
    display: block;
  }
}

/* —— Content chapters —— */
.at-main {
  min-width: 0;
}

.at-chapter {
  border-bottom: 1px solid var(--at-line-strong);
}

.at-chapter__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 16px;
  padding: clamp(24px, 4vw, 40px) var(--at-sheet-pad) 20px;
  border-bottom: 1px solid var(--at-line);
}

.at-chapter__frame-tag {
  display: none;
}

.at-chapter__titles h2 {
  margin: 0;
  font-family: var(--at-font-en);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 300;
  letter-spacing: 0.1em;
  line-height: 1.1;
}

.at-chapter__titles p {
  margin: 6px 0 0;
  font-family: var(--at-font-jp);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--at-muted);
}

.at-chapter__count {
  margin: 0;
  font-family: var(--at-font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--at-muted);
  text-align: right;
}

/* —— Structural image grid (production parity) —— */
.at-grid {
  display: grid;
  gap: var(--at-gap);
  border-top: 1px solid var(--at-line-strong);
}

.at-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.at-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.at-grid__cell {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--at-line-strong);
  border-bottom: 1px solid var(--at-line-strong);
  background: #e8e4dc;
  overflow: hidden;
}

.at-grid--3 .at-grid__cell:nth-child(3n),
.at-grid--2 .at-grid__cell:nth-child(2n) {
  border-right: none;
}

.at-grid__cell a {
  display: block;
  aspect-ratio: 1280 / 400;
}

.at-grid--2 .at-grid__cell a {
  aspect-ratio: 1280 / 400;
}

.at-grid__cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--at-ease);
}

.at-grid__cell a:hover img {
  transform: scale(1.02);
}

@media (max-width: 720px) {
  .at-grid--3 {
    grid-template-columns: 1fr;
  }

  .at-grid--3 .at-grid__cell {
    border-right: none;
  }

  .at-grid--2 {
    grid-template-columns: 1fr;
  }

  .at-grid--2 .at-grid__cell {
    border-right: none;
  }
}

/* —— Phase 2 placeholder —— */
.at-chapter--soon .at-chapter__body {
  padding: 32px var(--at-sheet-pad) 40px;
}

.at-soon {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--at-line-strong);
  font-family: var(--at-font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--at-muted);
  text-align: center;
  background: color-mix(in srgb, var(--at-bg) 50%, transparent);
}

/* —— Preview dock —— */
.at-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  padding: 10px 12px;
  font-family: var(--at-font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--at-ink) 92%, transparent);
  color: var(--at-paper);
}

.at-dock a {
  color: inherit;
  opacity: 0.75;
  text-decoration: none;
}

.at-dock a:hover,
.at-dock a.is-here {
  opacity: 1;
  text-decoration: underline;
}

body.atlas-page--preview {
  padding-bottom: 44px;
}

/* —— Full build: production parity images + office/news —— */
.atlas-page--full .at-sheet {
  max-width: none;
  border-left: none;
  border-right: none;
  box-shadow: none;
}

.atlas-page--full .at-hero__frame--full {
  margin: 0;
  border-left: none;
  border-right: none;
}

.atlas-page--full .at-hero__slides {
  max-height: none;
  aspect-ratio: 2560 / 800;
}

.atlas-page--full .at-grid__cell a {
  aspect-ratio: auto;
}

.atlas-page--full .at-grid__cell img {
  width: 100%;
  height: auto;
  object-fit: unset;
  display: block;
}

.atlas-page--full .at-grid--3 {
  grid-template-columns: 1fr;
}

.atlas-page--full .at-grid--2 {
  grid-template-columns: 1fr;
}

.atlas-page--full .at-grid--6 {
  grid-template-columns: repeat(3, 1fr);
}

.atlas-page--full .at-grid--3x2,
.atlas-page--full .at-grid--3tight {
  grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 992px) {
  .atlas-page--full .at-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .atlas-page--full .at-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .atlas-page--full .at-grid--6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 575px) {
  .atlas-page--full .at-grid--3x2,
  .atlas-page--full .at-grid--3tight {
    grid-template-columns: 1fr;
  }
}

.atlas-page--full .at-grid--3 .at-grid__cell:nth-child(3n),
.atlas-page--full .at-grid--2 .at-grid__cell:nth-child(2n),
.atlas-page--full .at-grid--6 .at-grid__cell,
.atlas-page--full .at-grid--3x2 .at-grid__cell {
  border-right: 1px solid var(--at-line-strong);
}

.atlas-page--full .at-grid--3 .at-grid__cell:nth-child(3n) {
  border-right: none;
}

.atlas-page--full .at-grid--2 .at-grid__cell:nth-child(2n) {
  border-right: none;
}

.atlas-page--full .at-grid--6 .at-grid__cell:nth-child(6n) {
  border-right: none;
}

.atlas-page--full .at-grid--3x2 .at-grid__cell:nth-child(3n) {
  border-right: none;
}

.at-office {
  padding: clamp(20px, 4vw, 36px) var(--at-sheet-pad);
  border-bottom: 1px solid var(--at-line);
}

.at-office__eyebrow {
  margin: 0 0 8px;
  font-family: var(--at-font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--at-muted);
}

.at-office__tagline {
  margin: 0 0 16px;
  font-family: var(--at-font-jp);
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  letter-spacing: 0.08em;
}

.at-office__lead,
.at-office__desc {
  margin: 0 0 12px;
  max-width: 46em;
  font-size: 14px;
  line-height: 1.85;
  color: var(--at-muted);
}

.at-contact-wrap {
  position: relative;
}

.at-inquiry {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(to top, rgba(26, 24, 22, 0.55), transparent 55%);
  pointer-events: none;
}

.at-inquiry__inner {
  pointer-events: auto;
  text-align: center;
  color: #fff;
}

.at-inquiry__dek {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
}

.at-inquiry__links {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.at-inquiry__links a {
  color: #fff;
  text-decoration: none;
}

.at-inquiry__links a:hover {
  text-decoration: underline;
}

.at-inquiry__sep {
  margin: 0 8px;
  opacity: 0.6;
}

.at-news__list {
  margin: 0;
  padding: 0 var(--at-sheet-pad) clamp(24px, 4vw, 40px);
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  border-bottom: 1px solid var(--at-line);
}

.at-news__item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px 20px;
  padding: 14px 0;
  border-top: 1px solid var(--at-line);
  font-size: 13px;
  line-height: 1.75;
}

.at-news__date {
  font-family: var(--at-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--at-muted);
}

.at-news__body a {
  color: var(--at-ink);
}

.at-chapter__sub {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--at-muted);
  letter-spacing: 0.06em;
}

.at-mosaic {
  min-width: 0;
}

#main-content {
  margin-bottom: 0 !important;
}

/* —— Mobile / tablet (production index-home parity) —— */
@media (max-width: 768px) {
  .at-sheet {
    overflow-x: clip;
  }

  .at-mosaic {
    overflow-x: clip;
  }

  .at-hero__frame {
    margin: 0;
    border-left: none;
    border-right: none;
  }

  .at-hero__slides {
    aspect-ratio: auto;
    height: 60vh;
    min-height: 240px;
    max-height: min(60vh, 520px);
  }

  .at-hero__slide a,
  .at-hero__slide img {
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .at-hero__titleblock {
    padding-left: 14px;
    padding-right: 14px;
  }

  .at-hero__dek {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .at-chapter__head {
    padding-left: var(--at-pad);
    padding-right: var(--at-pad);
  }

  .at-office {
    padding: 16px var(--at-pad);
  }

  .at-news__list {
    max-height: 180px;
    padding-left: var(--at-pad);
    padding-right: var(--at-pad);
  }

  .at-news__item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .atlas-page--full .at-hero__slides {
    aspect-ratio: auto;
    max-height: min(60vh, 520px);
    height: 60vh;
    min-height: 240px;
  }

  .atlas-page--full .at-hero__slide a,
  .atlas-page--full .at-hero__slide img {
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .at-dock {
    padding: 8px 10px;
    gap: 4px 8px;
    font-size: 8px;
  }

  body.atlas-page {
    padding-bottom: 52px;
  }
}
