/* Access */

/* レイアウト */
.top-access-title {
  position: relative;
  z-index: 3;
  max-width: 1440px;
  margin: 0 auto clamp(18px, 2.7vw, 42px);
}

.top-access-title-box {
  --access-title-width: clamp(126px, 11.2vw, 190px);
  position: relative;
  display: block;
  width: var(--access-title-width);
  aspect-ratio: 336 / 108;
}

.top-access-title-label {
  position: absolute;
  inset: 7.6% auto auto 0;
  font: 400 calc(var(--access-title-width) * .3345) / 1 'Higure Gothic', sans-serif;
  letter-spacing: normal;
  transform: rotate(-8.84deg) scaleX(1.013);
  transform-origin: left .88em;
}

.top-access-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  grid-template-areas: "route information";
  align-items: start;
  gap: clamp(24px, 4vw, 70px);
  max-width: 1440px;
  margin-inline: auto;
}

.top-access-route {
  grid-area: route;
  min-width: 0;
}

.top-access-summary {
  grid-area: information;
  min-width: 0;
  container-type: inline-size;
}

@media (min-width: 761px) {
  @supports (grid-template-rows: subgrid) {
    .top-access-layout {
      grid-template-areas: "route ." "route information";
      row-gap: 0;
    }
    .top-access-route {
      display: grid;
      grid-template-rows: subgrid;
      align-self: stretch;
    }
    .access-map-legend { grid-row: 1; }
    .access-map-figure { grid-row: 2; }
    .top-access-summary {
      /* The map artboard has a thin transparent margin above the torn paper. */
      margin-block-start: clamp(2px, .35vw, 6px);
    }
  }
}

.access-map-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(84%, 660px);
  gap: clamp(18px, 3.8vw, 54px);
  margin: 0 auto clamp(10px, 1.35vw, 20px);
}

.access-map-legend[hidden] {
  display: none;
}

.access-map-legend button {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  aspect-ratio: 430 / 194;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  font-size: clamp(10px, .86vw, 13px);
  line-height: 1.12;
}

/* The tape layers share an artboard and can be painted as one image. */
.access-map-legend button::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: var(--access-tape) center / contain no-repeat;
}

.access-map-legend [data-access-route="oedo"] {
  --access-tape: url("../../images/access/legend-oedo.webp");
  --label-x: 5%;
  --label-y: 13%;
}

.access-map-legend [data-access-route="hibiya"] {
  --access-tape: url("../../images/access/legend-hibiya.webp");
  --label-x: -5%;
  --label-y: -1%;
}

.access-map-legend [data-access-route="namboku"] {
  --access-tape: url("../../images/access/legend-namboku.webp");
  --label-x: -4%;
  --label-y: 7%;
}

.access-map-legend .button-face {
  position: relative;
  left: var(--label-x);
  top: var(--label-y);
  white-space: nowrap;
}

@media (max-width: 990px) {
  .access-map-legend .button-face > span {
    display: block;
  }
}

.access-map-legend button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.access-map-legend:has(button[aria-pressed="true"]) button[aria-pressed="false"],
.access-map-art:has([data-access-station][aria-pressed="true"]) [data-access-station][aria-pressed="false"] {
  opacity: .62;
}

.access-map-figure {
  position: relative;
  align-self: start;
}

.access-map-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 1156 / 758;
}

/* 部品ごとに焼き込んだ地図の画像と、押せる範囲（駅・会場）を、元の地図の座標どおりに重ねる。 */
.access-map-art :is(img, [data-access-station], [data-access-venue]) {
  position: absolute;
  left: var(--l);
  top: var(--t);
  width: var(--w);
  height: var(--h);
  max-width: none;
}

.access-map-art img {
  pointer-events: none;
}

/* 駅名・出口・会場名は、画像に描き込まずにページの文字（Accessの欄のフォント）で描く。
   押せる範囲と同じ viewBox の SVG に、元の地図（access-map-art.svg）の文字を同じ位置・角度・大きさで置いてある（tools/bake_access_map.py）。 */
.access-map-text {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.access-map-art .is-muted {
  opacity: .26;
}

.access-map-art :is([data-access-station], [data-access-venue]):focus {
  outline: none;
}

.access-map-art :is([data-access-station], [data-access-venue]):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 0;
  border-radius: 8px;
}

/* On the two-column layout, station details use the space below the map. */
.access-map-details {
  position: absolute;
  inset-block-start: 100%;
  inset-inline: 0;
}

.access-map-details:not(:empty) {
  padding: 8px 12px;
  background: var(--white);
  border-left: 2px solid var(--blue);
  font-size: clamp(14px, 1.25vw, 17px);
}

.top-access-information dl {
  margin: 0;
}

.top-access-information dl > div {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: clamp(10px, 4cqi, 22px);
  padding: clamp(14px, 4cqi, 19px) 0 clamp(17px, 5.6cqi, 28px);
  border-bottom: 1px solid #0041c440;
}

.top-access-information dt {
  font-size: clamp(13px, 3.6cqi, 16px);
  padding-top: .42em;
}

.top-access-information dd {
  margin: 0;
  font-size: clamp(18px, 7cqi, 34px);
  line-height: 1.6;
}

.top-access-information small {
  font-size: clamp(12px, 3.5cqi, 16px);
}

.top-access-information time {
  white-space: nowrap;
}

:where(.top-access) .top-access-dash {
  display: inline-block;
  padding: 0 clamp(3px, 1.6cqi, 8px);
}

.top-access-hours {
  display: block;
  font-size: clamp(16px, 4.7cqi, 20px);
}

.top-access-venue-line {
  display: flex;
  align-items: center;
  gap: clamp(5px, 2cqi, 12px);
}

.top-access-venue-name {
  white-space: nowrap;
  font-size: clamp(16px, 6.7cqi, 34px);
}

.top-access-address {
  display: block;
  font-size: clamp(14px, 3.8cqi, 16px);
  line-height: 1.9;
  margin-top: 14px;
}

.top-access-street {
  white-space: nowrap;
}

/* Google Maps へのリンク。前は会場の下の 1 行（Google Maps →）だったが、カードの右下に貼った青いテープにした。
   その行のあった高さ（62px）だけ、カードの下を空けておき、テープはそこに重ねる。 */
.top-access-map-space {
  display: block;
  height: 62px;
}

/* テープはカードからはみ出すので、切り抜き（clip-path）のあるカードの外に置く。
   枠はカードと同じ大きさ・同じ傾きで重ね、テープはその中でカードの右下から測って置く（カードの幅に対する割合）。
   位置・角度・大きさ・字の大きさは、ユーザーのモックアップ（1440px の画面のカード）から測った値。素材は tape-blue.webp。 */
.top-access-summary {
  position: relative;
}

.top-access-map-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: rotate(2.77deg);
  transform-origin: top left;
}

:where(.top-access) .top-access-map-tape {
  --tape-right: 28.28cqi;
  --tape-bottom: 8.75cqi;
  --tape-width: 71.43cqi;
  --button-angle: 8deg;
  position: absolute;
  right: calc(var(--tape-right) - var(--tape-width) / 2);
  bottom: calc(var(--tape-bottom) - var(--tape-width) / 6);
  width: var(--tape-width);
  aspect-ratio: 3;
  transform: rotate(-11.95deg);
  pointer-events: auto;
}

:where(.top-access) .top-access-map-tape > .button-face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding-top: .1em;
  background: url("../../images/common/tape-blue.webp") center / 100% 100% no-repeat;
  color: var(--white);
  font-size: 4.04cqi;
  line-height: 1;
  white-space: nowrap;
}

/* 配色と装飾 */
.top-access {
  color: var(--blue);
  background-color: var(--white);
  padding-top: clamp(74px, 7.6vw, 128px);
}

:where(.top-access) .top-access-admission {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(48px, 23cqi, 112px);
  aspect-ratio: 2.55 / 1;
  margin-inline-end: 3px;
  background: var(--red);
  color: var(--white);
  clip-path: var(--burst);
  transform: rotate(-14.77deg);
  font-size: clamp(8px, 3.5cqi, 16px);
  line-height: 1;
  white-space: nowrap;
}

.top-access-information {
  padding: clamp(15px, 4.5cqi, 24px) clamp(17px, 5.8cqi, 30px) 12px;
  color: var(--blue);
  background: linear-gradient(#fff6, #fff6), var(--white) url("../../images/tape/paper.webp") center / 38rem auto;
  clip-path: polygon(0 0, 98.36% 0, 99.55% 22.54%, 98.78% 49.03%, 100% 74.43%, 98.24% 100%, 1.82% 100%, .62% 73.49%, 1.37% 48.39%);
  transform: rotate(2.77deg);
  transform-origin: top left;
}

.top-access-information dl > div {
  border-color: #0041c450;
}

/* スマホ：Accessの欄を「1枚の絵」として組む */
@media (max-width: 760px) {
  /* 見出し・地図・路線テープ・案内カードを、欄の左上からのずれで1つのマスに重ねて置く。
     欄の高さは、いちばん下の部品と下の余白（--access-bottom）で自動で決まる。
     単位 --u は欄の幅の 1%（390px の画面で 3.9px。欄の幅は画面の幅で、480px まで）。
     画面の幅が変わっても、欄の中身は字も含めて全部同じ比率で大きさを変える。
     部品ごとの数字は、配置ツール（https://claude.ai/artifact/KXv1fXDJHzQLRY7EPkV1zP）で決めた値をそのまま入れる。
       --piece-x / --piece-y：欄の左上からの横・縦のずれ　--piece-size：幅　--piece-angle：傾き（部品の真ん中で回す） */
  .top-access.content-section {
    --u: min(1vw, 4.8px);
    --access-bottom: 15.89;
    display: grid;
    grid-template-columns: calc(100 * var(--u));
    justify-content: center;
    padding: 0 0 calc(var(--access-bottom) * var(--u));
    /* 地図のはみ出した左右を切る（clip はスクロール枠を作らない）。 */
    overflow: clip visible;
  }
  /* 部品を包む箱はなくし、部品をじかに欄のマスに置く。 */
  .top-access-layout,
  .top-access-route,
  .access-map-figure {
    display: contents;
  }
  .top-access-title,
  .access-map-canvas,
  .top-access-summary,
  .access-map-legend button {
    grid-area: 1 / 1;
    align-self: start;
    justify-self: start;
    position: relative;
    inset: auto;
    width: calc(var(--piece-size) * var(--u));
    margin: calc(var(--piece-y) * var(--u)) 0 0 calc(var(--piece-x) * var(--u));
    rotate: var(--piece-angle);
  }
  /* 重なる順は、下から 地図・案内カード・見出し・テープ。 */
  /* 地図：まわりの余分なところを、ハサミで切ったように落とす。
       --crop-x / --crop-y / --crop-w / --crop-h：残す範囲（元の地図に対する %。左・上・幅・高さ）
       aspect-ratio：残す範囲の縦横比（1156 × 幅 : 758 × 高さ）。--piece-* は切ったあとの紙の位置と幅。
     縮尺は、元の地図の幅が 148u（--piece-size ÷ --crop-w）。390px の画面で、地図の絵を作った大きさ（約 578px）とほぼ同じ。
     切り口（clip-path）は、長さも向きもばらばらな直線と小さな段で、手でざっくり切ったように見せる。
     駅名の札（左の六本木駅・右の六本木一丁目駅）と下の会場のところだけは、切り口を外側に寄せて札にかからないようにしてある。 */
  .access-map-canvas {
    z-index: 3;
    --piece-x: 2.12;
    --piece-y: 76.92;
    --piece-size: 96;
    --piece-angle: 0deg;
    --crop-x: 16.3;
    --crop-y: 11.5;
    --crop-w: 64.865;
    --crop-h: 80.447;
    aspect-ratio: 74983.9 / 60978.8;
    clip-path: polygon(9.5% 2%, 23% 5.2%, 24.4% 3.4%, 47% 0.4%, 56.5% 9%, 63% 4%, 86% 0%, 96.5% 3%, 100% 8.5%, 99.7% 26%, 99.6% 41.5%, 97.6% 42.8%, 90.8% 60%, 95.6% 79.5%, 99.2% 84%, 90.5% 99.4%, 71% 95.8%, 69.8% 97.8%, 44% 100%, 34.5% 92%, 15% 97.6%, 5.5% 94%, 0% 85%, 5.6% 68%, 0.4% 44%, 2.4% 42.5%, 0.9% 33%, 4.2% 22.5%, 0.6% 15.5%);
  }
  /* 地図の部品（絵・駅・会場）は、元の地図での位置（--l / --t / --w / --h）を、残す範囲に対する位置に直して置く。 */
  .access-map-canvas.access-map-art > picture > img,
  .access-map-canvas.access-map-art > :is([data-access-station], [data-access-venue]) {
    left: calc((var(--l) - var(--crop-x) * 1%) * 100 / var(--crop-w));
    top: calc((var(--t) - var(--crop-y) * 1%) * 100 / var(--crop-h));
    width: calc(var(--w) * 100 / var(--crop-w));
    height: calc(var(--h) * 100 / var(--crop-h));
  }
  /* 駅名を押したときの説明は出さない（駅名はただの文字にする）。 */
  .access-map-art [data-access-station] {
    pointer-events: none;
  }
  .access-map-details {
    display: none;
  }
  .top-access-summary {
    z-index: 4;
    --piece-x: 6.05;
    --piece-y: 175.67;
    --piece-size: 87.18;
    --piece-angle: 2.8deg;
  }
  .top-access-title {
    z-index: 6;
    --piece-x: 62.9;
    --piece-y: 13.72;
    --piece-size: 32.43;
    --piece-angle: 14.5deg;
  }
  /* 見出し：字の大きさは幅に比例する。 */
  .top-access-title-box {
    --access-title-width: calc(var(--piece-size) * var(--u));
  }
  /* 路線ボタン：テープの欄は欄全体に重ね（押せるのはテープだけ）、テープを --piece-* で置く。 */
  .access-map-legend {
    grid-area: 1 / 1;
    align-self: start;
    justify-self: start;
    display: grid;
    grid-template-columns: 100%;
    width: calc(100 * var(--u));
    margin: 0;
    gap: 0;
    pointer-events: none;
  }
  .access-map-legend button {
    --button-angle: 2deg;
    z-index: 7;
    min-height: 0;
    pointer-events: auto;
  }
  /* テープの文字：会社名と路線名を、テープの左上を基準に別々に置く。
       --sub-x / --sub-y：会社名の真ん中の位置　--sub-size：字の大きさ　--sub-angle：傾き（路線名は --name-*）
     単位はどれもテープの幅に対する %。テープを大きくすると、文字も同じ比率で大きくなる。 */
  .access-map-legend .button-face {
    position: absolute;
    inset: 0;
  }
  .access-map-legend .button-face > span {
    --tape-unit: calc(var(--piece-size) * var(--u) / 100);
    position: absolute;
    left: calc(var(--text-x) * var(--tape-unit));
    top: calc(var(--text-y) * var(--tape-unit));
    translate: -50% -50%;
    rotate: var(--text-angle);
    font-size: calc(var(--text-size) * var(--tape-unit));
    line-height: 1;
    letter-spacing: .1em;
    white-space: nowrap;
  }
  .access-map-legend .button-face > span:first-child {
    --text-x: var(--sub-x);
    --text-y: var(--sub-y);
    --text-size: var(--sub-size);
    --text-angle: var(--sub-angle);
  }
  .access-map-legend .button-face > span:last-child {
    --text-x: var(--name-x);
    --text-y: var(--name-y);
    --text-size: var(--name-size);
    --text-angle: var(--name-angle);
  }
  /* テープの枠は絵と同じ比率。 */
  .access-map-legend [data-access-route="oedo"] {
    --piece-x: 3.16;
    --piece-y: 22.49;
    --piece-size: 42.96;
    --piece-angle: -2.9deg;
    --sub-x: 33.98;
    --sub-y: 26.7;
    --sub-size: 6.56;
    --sub-angle: 0deg;
    --name-x: 63.77;
    --name-y: 25.75;
    --name-size: 8.75;
    --name-angle: 0deg;
    aspect-ratio: 430 / 177;
  }
  .access-map-legend [data-access-route="hibiya"] {
    --piece-x: 30.88;
    --piece-y: 37.57;
    --piece-size: 42.96;
    --piece-angle: -6.2deg;
    --sub-x: 22.69;
    --sub-y: 23.91;
    --sub-size: 6.56;
    --sub-angle: 0deg;
    --name-x: 63.31;
    --name-y: 22.96;
    --name-size: 8.75;
    --name-angle: 0deg;
    aspect-ratio: 430 / 194;
  }
  .access-map-legend [data-access-route="namboku"] {
    --piece-x: 56.63;
    --piece-y: 56.12;
    --piece-size: 42.96;
    --piece-angle: 6.3deg;
    --sub-x: 29.6;
    --sub-y: 22.5;
    --sub-size: 6.56;
    --sub-angle: 0deg;
    --name-x: 65.41;
    --name-y: 21.55;
    --name-size: 8.75;
    --name-angle: 0deg;
    aspect-ratio: 430 / 166;
  }
  /* 案内カード：中の字や余白はカードの幅に対する割合（cqi）にして、カードごと同じ比率で大きさを変える。
     値は、カードの幅が 340px のときに今までと同じ大きさになるようにしてある。傾きはカードの真ん中で回す（--piece-angle）。 */
  .top-access-information {
    padding: 4.5cqi 5.8cqi 3.5294cqi;
    background-size: auto, 178.8235cqi auto;
    transform: none;
  }
  .top-access-information dl > div {
    gap: 4cqi;
    padding: 4.1176cqi 0 5.6cqi;
  }
  .top-access-information dt {
    font-size: 3.8235cqi;
  }
  .top-access-information dd {
    font-size: 7cqi;
  }
  .top-access-information small {
    font-size: 3.5294cqi;
  }
  :where(.top-access) .top-access-dash {
    padding: 0 1.6cqi;
  }
  .top-access-hours {
    font-size: 4.7059cqi;
  }
  .top-access-venue-line {
    gap: 2cqi;
  }
  .top-access-venue-name {
    font-size: 6.7cqi;
  }
  .top-access-address {
    margin-top: 4.1176cqi;
    font-size: 4.1176cqi;
  }
  /* スマホでは、テープは地図とカードのあいだ（地図の下の端に重ねる）に貼るので、カードの下は空けない。
     テープはカードの左上から測って置く（--tape-x / --tape-y はテープの真ん中、カードの幅に対する %）。
     カードはカードごと回っている（--piece-angle）ので、テープの枠は回さず、テープの角度はカードに対する角度。 */
  .top-access-map-space {
    display: none;
  }
  .top-access-map-frame {
    transform: none;
  }
  :where(.top-access) .top-access-map-tape {
    /* カードを 8u 下げたとき（2026-12-01）、テープは動かさないよう、その分をカードの向きに直して戻してある。 */
    --tape-x: 69.55cqi;
    --tape-y: -20.05cqi;
    --tape-width: 66.64cqi;
    --tape-angle: -6.92deg;
    left: calc(var(--tape-x) - var(--tape-width) / 2);
    top: calc(var(--tape-y) - var(--tape-width) / 6);
    right: auto;
    bottom: auto;
    transform: rotate(var(--tape-angle));
  }
  :where(.top-access) .top-access-map-tape > .button-face {
    font-size: 3.75cqi;
  }
  :where(.top-access) .top-access-admission {
    width: 23cqi;
    margin-inline-end: .8824cqi;
    font-size: 3.5cqi;
  }
}
