/*!
 * Adapted from "Aperture Reveal Image Carousel" by Kedhareswer Naidu
 * https://21st.dev/@kedhareswer/components/aperture-carousel
 * Ported to plain JavaScript/CSS (no React) and modified for choicedoc.

MIT License

Copyright (c) Kedhareswer Naidu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/* ───────── 11/22 첫 화면 — 조리개 넘김 ─────────
   사장님이 주신 Aperture Carousel(리액트) 소스를 그대로 옮김:
   누른 자리에서 다음 사진이 동그랗게 열림 · 열리는 가장자리에 가는 금색 테 · 글자가 아래에서 솟아오름
   · 다음 장면까지 차오르는 선 · 마우스가 「다음/이전」 렌즈로 바뀜. 세 장면은 이야기로 이어짐(질문 → 설계 → 상담). */
.hero-ap { padding: 0; background: var(--night); }
.ap-root { --ap-dur: 6500ms; position: relative; width: 100%; height: clamp(640px, calc(100svh - 84px), 920px); overflow: hidden; background: #0d0d0f; color: #fff; user-select: none; -webkit-user-select: none; touch-action: pan-y; outline: none; isolation: isolate; }
.ap-root:focus-visible { box-shadow: inset 0 0 0 2px var(--gold-soft); }
@media (hover: hover) and (pointer: fine) {
  .ap-root[data-lens='1'] { cursor: none; }
  .ap-root[data-lens='1'] a, .ap-root[data-lens='1'] button { cursor: pointer; }
}
.ap-layer { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.ap-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 50%; display: block; pointer-events: none; }
/* 머무는 동안 아주 천천히 다가감(소스의 1.18→1 열림 뒤에 이어지는 숨) */
.ap-base .ap-img { animation: apDrift calc(var(--ap-dur) + 2500ms) cubic-bezier(.25,.6,.3,1) both; }
.ap-root[data-paused='1'] .ap-base .ap-img { animation-play-state: paused; }
@keyframes apDrift { from { transform: scale(1); } to { transform: scale(1.06); } }
.ap-ring { position: absolute; left: 0; top: 0; z-index: 1; border-radius: 50%; border: 1px solid rgba(230,213,176,.95); box-shadow: 0 0 26px rgba(220,201,163,.35), inset 0 0 26px rgba(220,201,163,.18); pointer-events: none; opacity: 0; }
.ap-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7,13,34,.9) 0%, rgba(7,13,34,.74) 28%, rgba(7,13,34,.26) 56%, rgba(7,13,34,0) 74%),
    linear-gradient(0deg, rgba(7,13,34,.62) 0%, rgba(7,13,34,0) 36%),
    linear-gradient(180deg, rgba(7,13,34,.3) 0%, rgba(7,13,34,0) 20%); }

.ap-ui { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(52px, 7.5vh, 88px) 0 clamp(70px, 10vh, 100px); }
.ap-ui a, .ap-ui button { pointer-events: auto; }
/* 예전 첫 화면의 두 칸 나눔(.hero .wrap 격자)을 끔 */
.hero-ap .wrap { display: block; grid-template-columns: none; gap: 0; padding: 0; position: relative; z-index: auto; }
.hero-ap .wrap.ap-foot { display: flex; }
.ap-head .kicker { color: var(--gold-soft); margin-bottom: 20px; }
.ap-head h1 { color: #fff; font-size: clamp(34px, 3.8vw, 56px); margin: 0 0 18px; text-shadow: 0 2px 30px rgba(0,0,0,.22); }
.ap-head h1 .soft { color: var(--gold-soft); }
.ap-head .lead { color: #c3cadb; max-width: 37em; font-size: 17px; line-height: 1.7; margin: 0 0 28px; }
.ap-head .lead b { color: #fff; font-weight: 700; }
.ap-head .cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 8px; }
.ap-head .btn-gold { min-height: 54px; padding: 0 28px; box-shadow: 0 18px 40px -22px rgba(184,151,95,.9); }
.ap-head .text-link { color: #fff; border-bottom-color: var(--gold-soft); }

.ap-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 36px; }
.ap-texts { position: relative; min-width: 0; max-width: 580px; }
.ap-text[hidden] { display: none !important; }
.ap-line { display: block; overflow: hidden; margin: 0; padding: 0 0 2px; }
.ap-line > span { display: block; }
.ap-text.rise .ap-line > span { animation: apRise .9s cubic-bezier(.2,.8,.2,1) both; }
.ap-text.rise .ap-line:nth-child(2) > span { animation-delay: .07s; }
.ap-text.rise .ap-line:nth-child(3) > span { animation-delay: .14s; }
.ap-text.rise .ap-line:nth-child(4) > span { animation-delay: .21s; }
@keyframes apRise { from { transform: translateY(105%); } to { transform: none; } }
.ap-k { margin-bottom: 12px; }
.ap-k > span { font-size: 13.5px; font-weight: 700; letter-spacing: .08em; color: var(--gold-soft); }
.ap-title { font-family: var(--serif-ko); font-weight: 700; font-size: clamp(26px, 2.6vw, 40px); line-height: 1.24; letter-spacing: -.02em; color: #fff; text-wrap: balance; }
.ap-cap { margin-top: 12px; }
.ap-cap > span { font-size: 16.5px; line-height: 1.65; color: #d7dce6; max-width: 32em; }
.ap-go { margin-top: 16px; padding: 4px; margin-left: -4px; }
.ap-go a { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 15px; padding: 11px 18px 11px 22px; border: 1px solid rgba(220,201,163,.6); border-radius: 999px; background: rgba(7,13,34,.38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .25s, border-color .25s; }
.ap-go a::after { content: '→'; color: var(--gold-soft); transition: transform .25s; }
.ap-go a:hover { background: rgba(184,151,95,.28); border-color: var(--gold-soft); }
.ap-go a:hover::after { transform: translateX(3px); }

.ap-side { flex: none; display: flex; align-items: center; gap: 22px; }
.ap-count { display: flex; align-items: center; gap: 12px; font-family: var(--serif-en); font-style: italic; font-size: 17px; letter-spacing: .04em; color: rgba(255,255,255,.75); }
.ap-count b { font-size: 34px; font-weight: 500; color: #fff; }
.ap-count i { width: 36px; height: 1px; background: rgba(255,255,255,.5); }
.ap-arrows { display: flex; gap: 8px; }
.ap-arrows button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(220,201,163,.6); background: rgba(7,13,34,.3); color: #fff; display: grid; place-items: center; padding: 0; transition: background .25s, border-color .25s; }
.ap-arrows button:hover { background: rgba(184,151,95,.3); border-color: var(--gold-soft); }
.ap-arrows svg { width: 18px; height: 18px; }
/* PC: 숫자·화살표는 맨 아래 선 바로 위 오른쪽 끝 — 사진 속 사람·화면을 가리지 않게(11/22) */
@media (min-width: 761px) {
  .hero-ap .wrap.ap-foot { position: static; }
  .ap-side { position: absolute; right: max(24px, calc((100% - var(--wrap)) / 2)); bottom: calc(clamp(30px, 4.5vh, 44px) + 16px); z-index: 3; }
  .ap-count { text-shadow: 0 2px 14px rgba(7,13,34,.7); }
}

.ap-track { position: absolute; z-index: 3; left: max(24px, calc((100% - var(--wrap)) / 2)); right: max(24px, calc((100% - var(--wrap)) / 2)); bottom: clamp(30px, 4.5vh, 44px); height: 1px; background: rgba(255,255,255,.22); pointer-events: none; }
.ap-fill { height: 100%; background: linear-gradient(90deg, #e6d5b0, #b8975f); transform-origin: left; transform: scaleX(0); }
.ap-fill[data-run='1'] { animation: apFill var(--ap-dur) linear forwards; }
.ap-root[data-paused='1'] .ap-fill { animation-play-state: paused; }
@keyframes apFill { to { transform: scaleX(1); } }

.ap-lens { position: absolute; left: 0; top: 0; z-index: 4; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; border: 1px solid rgba(230,213,176,.9); display: grid; place-items: center; font-size: 13px; font-weight: 700; letter-spacing: .14em; color: #fff; background: rgba(7,13,34,.16); pointer-events: none; opacity: 0; transition: opacity .25s ease; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ap-lens[data-on='1'] { opacity: 1; }
@media (hover: none), (pointer: coarse) { .ap-lens { display: none; } }
.ap-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .ap-text.rise .ap-line > span, .ap-base .ap-img { animation: none; }
}

@media (max-width: 760px) {
  /* 폰: 사진은 위 58%, 장면 설명은 그 아래 곤색 바탕 — 사진 속 주인공(빛·화면·둥근 문)이 글에 가리지 않게 */
  .ap-root { height: clamp(720px, calc(100svh - 66px), 880px); background: var(--night); }
  .ap-layer { bottom: auto; height: 58%; }
  .ap-img { object-position: var(--ap-pos, 60%) 50%; }
  .ap-shade { background: linear-gradient(180deg, rgba(7,13,34,.9) 0%, rgba(7,13,34,.72) 24%, rgba(7,13,34,.08) 40%, rgba(7,13,34,0) 46%, rgba(7,13,34,.55) 52%, #070d22 58.5%, #070d22 100%); }
  .ap-side { width: 100%; }
  .ap-ui { padding: 30px 0 52px; }
  .ap-head .kicker { font-size: 13.5px; margin-bottom: 14px; }
  .ap-head h1 { font-size: clamp(29px, 8.2vw, 38px); margin-bottom: 20px; }
  .ap-head .lead { display: none; }
  .ap-head .btn-gold { min-height: 48px; padding: 0 22px; font-size: 15.5px; }
  .ap-head .text-link { font-size: 15px; }
  .ap-foot { flex-direction: column; align-items: stretch; gap: 20px; }
  .ap-k > span { font-size: 12.5px; }
  .ap-title { font-size: 25px; }
  .ap-cap > span { font-size: 15px; line-height: 1.6; }
  .ap-go a { font-size: 14.5px; padding: 10px 16px 10px 18px; }
  .ap-side { justify-content: space-between; }
  .ap-count b { font-size: 28px; }
  .ap-arrows button { width: 44px; height: 44px; }
  .ap-track { bottom: 28px; left: 20px; right: 20px; }
}

/* ───────── 11/22 밤 「너무 기업 같아, 바탕이 어두워서 묵직해」 → 밝은 첫 화면 ─────────
   아이보리 바탕 · 곤색 글자 · 금색 포인트. 사진은 밝은 세 장면(만든 화면 → 상담 → 원장님과 함께) */
.hero-ap { background: #faf7f1; }
.ap-root { background: #f3ede3; color: var(--ink); }
.ap-ring { border-color: rgba(184,151,95,.95); box-shadow: 0 0 22px rgba(184,151,95,.35), inset 0 0 22px rgba(184,151,95,.15); }
.ap-shade { background:
  linear-gradient(90deg, rgba(250,247,241,.97) 0%, rgba(250,247,241,.9) 28%, rgba(250,247,241,.5) 43%, rgba(250,247,241,0) 58%),
  linear-gradient(0deg, rgba(250,247,241,.6) 0%, rgba(250,247,241,0) 26%); }
.ap-head .kicker { color: #8f7444; }
.ap-head h1 { color: var(--ink); text-shadow: none; }
.ap-head h1 .soft { color: var(--ink-2); }
.ap-head .lead { color: var(--muted); max-width: 31em; }
.ap-head .lead b { color: var(--ink); }
.ap-head .text-link { color: var(--ink); border-bottom-color: var(--gold); }
.ap-texts { max-width: 560px; }
.ap-k > span { color: #8f7444; }
.ap-title { color: var(--ink); }
.ap-cap > span { color: var(--muted); }
.ap-go a { color: var(--ink); background: rgba(255,255,255,.72); border-color: rgba(11,20,48,.22); }
.ap-go a::after { color: var(--gold); }
.ap-go a:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.ap-go a:hover::after { color: var(--gold-soft); }
.ap-count { color: rgba(11,20,48,.55); }
.ap-count b { color: var(--ink); }
.ap-count i { background: rgba(11,20,48,.35); }
.ap-arrows button { background: rgba(255,255,255,.82); border-color: rgba(11,20,48,.18); color: var(--ink); box-shadow: 0 10px 24px -14px rgba(11,20,48,.35); }
.ap-arrows button:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.ap-track { background: rgba(11,20,48,.12); }
.ap-lens { color: var(--ink); background: rgba(255,255,255,.42); border-color: rgba(184,151,95,.9); }
@media (min-width: 761px) { .ap-count { text-shadow: 0 1px 12px rgba(255,255,255,.8); } }
@media (max-width: 760px) {
  /* 폰: 제목 → 사진 → 장면 설명 차례로(사진 속 인물·기기가 글에 가리지 않게) */
  .ap-root { --ap-band-h: clamp(240px, 66vw, 320px); height: auto; background: #faf7f1; }
  .ap-layer { top: var(--ap-band-top, 260px); bottom: auto; height: var(--ap-band-h); left: 20px; right: 20px; border-radius: 18px; }
  .ap-shade, .ap-ring { display: none; }
  .ap-ui { position: relative; inset: auto; display: block; padding: 28px 0 58px; }
  .ap-foot { margin-top: calc(var(--ap-band-h) + 44px); }
  .ap-img { object-position: var(--ap-pos, 70%) 50%; }
}
@media (max-width: 760px) { .ap-texts { min-height: 268px; } }
@media (min-width: 761px) { .ap-head .lead { max-width: 29.5em; } }
