/* TripArchive main stylesheet
   Source: docs/design/triparchive-home-v2.html (font is loaded from the Pretendard CDN in base.html) */
/* Layout: scroll-triggered story (skill pattern). Aurora hero with a live shared trip board,
   then 흩어진 여행 → 1 같이 계획 → 2 여행 중 → 3 다시 꺼내 보기 → final CTA.
   Tokens follow design/design-system/MASTER.md (ui-ux-pro-max, Travel/Tourism). */
:root {
  --bg: #F0F9FF;            /* --color-background */
  --card: #FFFFFF;          /* --color-card */
  --fg: #0C4A6E;            /* --color-foreground, deep sea blue */
  --fg-strong: #082F49;
  --muted: #E8F2F8;         /* --color-muted */
  --muted-fg: #475569;      /* --color-muted-foreground */
  --border: #BAE6FD;        /* --color-border */
  --hair: #D7E8F3;
  --sky: #0EA5E9;           /* --color-primary: fills, routes, highlights */
  --sky-2: #38BDF8;         /* --color-secondary */
  --sky-ink: #0369A1;       /* text-safe blue, 5.9:1 on white */
  --sky-tint: #E0F2FE;
  --on-sky: #0F172A;
  --sun: #EA580C;           /* --color-accent / CTA */
  --on-sun: #000000;
  --sun-tint: #FFEDD5;
  --sun-ink: #C2410C;
  --archive: #15803D;       /* 다녀온 여행 */
  --archive-tint: #DCFCE7;
  --ring: #0369A1;
  --aurora-a: rgba(56, 189, 248, .55);
  --aurora-b: rgba(251, 146, 60, .42);
  --aurora-c: rgba(45, 212, 191, .40);
  --shadow-md: 0 4px 6px rgba(12, 74, 110, .08), 0 1px 2px rgba(12, 74, 110, .06);
  --shadow-lg: 0 10px 15px rgba(12, 74, 110, .10), 0 4px 6px rgba(12, 74, 110, .05);
  --shadow-xl: 0 20px 40px rgba(12, 74, 110, .16);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --t-14: .875rem; --t-16: 1rem; --t-18: 1.125rem; --t-22: 1.375rem; --t-28: 1.75rem;
  --t-40: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
  --t-56: clamp(2.25rem, 1.3rem + 4vw, 3.5rem);
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px; --space-3xl: 64px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #061521; --card: #0B2233; --fg: #E0F2FE; --fg-strong: #F0F9FF; --muted: #0F2A3F; --muted-fg: #9FB4C7;
    --border: #1D4864; --hair: #163A52; --sky: #38BDF8; --sky-2: #7DD3FC; --sky-ink: #7DD3FC; --sky-tint: #0C3250; --on-sky: #04131F;
    --sun: #FB923C; --on-sun: #000000; --sun-tint: #3B2112; --sun-ink: #FDBA74; --archive: #4ADE80; --archive-tint: #0E3320; --ring: #7DD3FC;
    --aurora-a: rgba(14, 165, 233, .35); --aurora-b: rgba(234, 88, 12, .22); --aurora-c: rgba(20, 184, 166, .25);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, .35); --shadow-lg: 0 10px 20px rgba(0, 0, 0, .4); --shadow-xl: 0 20px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #061521; --card: #0B2233; --fg: #E0F2FE; --fg-strong: #F0F9FF; --muted: #0F2A3F; --muted-fg: #9FB4C7;
  --border: #1D4864; --hair: #163A52; --sky: #38BDF8; --sky-2: #7DD3FC; --sky-ink: #7DD3FC; --sky-tint: #0C3250; --on-sky: #04131F;
  --sun: #FB923C; --on-sun: #000000; --sun-tint: #3B2112; --sun-ink: #FDBA74; --archive: #4ADE80; --archive-tint: #0E3320; --ring: #7DD3FC;
  --aurora-a: rgba(14, 165, 233, .35); --aurora-b: rgba(234, 88, 12, .22); --aurora-c: rgba(20, 184, 166, .25);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, .35); --shadow-lg: 0 10px 20px rgba(0, 0, 0, .4); --shadow-xl: 0 20px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: var(--t-16); line-height: 1.6;
  word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
.wrap {
  max-width: 1160px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { margin: 0; color: var(--fg-strong); line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--sky-ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* buttons — skill spec: 12/24 padding, r8, 600, 200ms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  min-height: 48px; padding: 12px 24px; border-radius: var(--r-sm);
  font-weight: 650; font-size: var(--t-16); line-height: 1; text-decoration: none;
  border: 2px solid transparent; cursor: pointer;
  transition: background-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease), border-color 200ms var(--ease);
}
.btn-cta { background: var(--sun); color: var(--on-sun); }
.btn-cta:hover { background: color-mix(in srgb, var(--sun) 88%, black); }
.btn-cta:active { transform: translateY(0); }
.btn-ghost { background: color-mix(in srgb, var(--card) 70%, transparent); color: var(--fg-strong); border-color: var(--sky); }
.btn-ghost:hover { background: var(--sky-tint); }

/* header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.top .wrap { display: flex; align-items: center; gap: var(--space-lg); min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: var(--t-18); color: var(--fg-strong); text-decoration: none; letter-spacing: -0.02em; }
.logo-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--sky), #2DD4BF); color: var(--on-sky); }
.logo-mark .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.nav { display: flex; gap: var(--space-xs); margin-left: auto; align-items: center; }
.nav a { color: var(--fg); text-decoration: none; font-weight: 550; font-size: var(--t-16); padding: 10px 12px; border-radius: var(--r-sm); min-height: 44px; display: inline-flex; align-items: center; transition: background-color 150ms var(--ease); }
.nav a:hover { background: var(--sky-tint); }
.nav .btn { min-height: 44px; padding: 10px 18px; margin-left: var(--space-sm); }
@media (max-width: 720px) { .nav a.hide-sm { display: none; } }

/* hero */
.hero { position: relative; padding-block: 96px 112px; background: linear-gradient(180deg, var(--sky-tint) 0%, var(--bg) 100%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--space-2xl); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-size: var(--t-56); font-weight: 800; margin-top: var(--space-lg); line-height: 1.15; }
.hero h1 em { font-style: normal; color: var(--sky-ink); }
.hero .lede { margin-top: var(--space-lg); font-size: var(--t-18); color: var(--muted-fg); max-width: 34em; line-height: 1.65; }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-xl); }

/* shared board */
.board { background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); overflow: hidden; }
.board-head { display: flex; align-items: center; gap: var(--space-md); padding: 20px 24px 16px; border-bottom: 1px solid var(--hair); flex-wrap: wrap; }
.board-title { min-width: 0; flex: 1 1 200px; }
.board-title h2 { font-size: var(--t-22); font-weight: 750; }
.board-title p { font-size: var(--t-14); color: var(--muted-fg); margin-top: 2px; }
.faces { display: flex; align-items: center; }
.face { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: var(--t-14); font-weight: 700; border: 2px solid var(--card); margin-left: -8px; color: #0F172A; }
.face:first-child { margin-left: 0; }
.f1, .f2, .f3, .f4 { background: var(--muted); color: var(--fg); }
.tabs { display: flex; gap: var(--space-xs); padding: 12px 16px 0; overflow-x: auto; }
.tab { min-height: 44px; padding: 8px 14px; border-radius: var(--r-sm) var(--r-sm) 0 0; border: 0; background: transparent; cursor: pointer; font-weight: 600; font-size: var(--t-14); color: var(--muted-fg); white-space: nowrap; border-bottom: 2px solid transparent; transition: color 150ms var(--ease), border-color 150ms var(--ease); }
.tab[aria-selected="true"] { color: var(--fg-strong); border-bottom-color: var(--sky); }
.tab:hover { color: var(--fg-strong); }
.plan { list-style: none; margin: 0; padding: 8px 24px 20px; position: relative; }
.plan::before { content: ""; position: absolute; left: 103px; top: 26px; bottom: 34px; border-left: 2px dashed var(--sky); opacity: .7; }
.stop { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--space-md); align-items: center; padding: 12px 0; position: relative; }
.stop + .stop { border-top: 1px solid var(--hair); }
.time { font-size: var(--t-14); font-weight: 650; color: var(--muted-fg); text-align: right; padding-right: 4px; }
.stop-body { min-width: 0; display: flex; gap: var(--space-md); align-items: center; }
.pin { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--sky-tint); color: var(--sky-ink); position: relative; z-index: 1; }
.pin .icon { width: 18px; height: 18px; }
.stop-name { font-weight: 650; color: var(--fg-strong); }
.stop-meta { font-size: var(--t-14); color: var(--muted-fg); }
.vote { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 64px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--fg); cursor: pointer; font-weight: 650; font-size: var(--t-14); transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease); }
.vote .icon { width: 16px; height: 16px; }
.vote:hover { border-color: var(--sun); }
.vote[aria-pressed="true"] { background: var(--sun-tint); border-color: var(--sun); color: var(--sun-ink); }
.board-foot { display: flex; flex-wrap: wrap; gap: var(--space-md); justify-content: space-between; align-items: center; padding: 14px 24px; background: var(--muted); font-size: var(--t-14); color: var(--muted-fg); }
.board-foot b { color: var(--fg-strong); }

/* sections */
section { scroll-margin-top: 80px; }
.band { padding-block: 104px; }
.band + .band { padding-top: 0; }
.sec-head { max-width: 640px; }
.sec-head h2 { font-size: var(--t-40); font-weight: 800; }
.sec-head p { margin-top: var(--space-md); font-size: var(--t-18); color: var(--muted-fg); }
.kicker { font-size: var(--t-14); font-weight: 700; color: var(--sky-ink); letter-spacing: .04em; margin-bottom: var(--space-sm); display: block; }



/* chapters */
.chapter { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 72px; align-items: center; padding-block: 72px; }
.chapter.flip > :first-child { order: 2; }
@media (max-width: 900px) { .chapter, .chapter.flip { grid-template-columns: minmax(0, 1fr); } .chapter.flip > :first-child { order: 0; } }
.chapter h2 { font-size: var(--t-40); font-weight: 800; }
.chapter .copy > p { margin-top: var(--space-md); font-size: var(--t-18); color: var(--muted-fg); max-width: 32em; }
.panel { background: var(--card); border-radius: var(--r-xl); box-shadow: none; border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); padding: var(--space-lg); }

/* vote panel */
.poll h3 { font-size: var(--t-18); font-weight: 700; }
.poll .sub { font-size: var(--t-14); color: var(--muted-fg); margin-top: 2px; }
.opts { display: grid; gap: var(--space-sm); margin-top: var(--space-md); }
.opt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-md); align-items: center; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--hair); overflow: hidden; }
.opt .bar { position: absolute; inset: 0 auto 0 0; background: var(--sky-tint); z-index: 0; border-radius: inherit; }
.opt > :not(.bar) { position: relative; z-index: 1; }
.opt.lead { border-color: var(--sky); }
.opt.lead .bar { background: color-mix(in srgb, var(--sky) 22%, var(--card)); }
.opt-name { font-weight: 650; color: var(--fg-strong); min-width: 0; }
.opt-name small { display: block; font-weight: 500; color: var(--muted-fg); font-size: var(--t-14); }
.opt-n { font-weight: 750; color: var(--fg-strong); }

/* today panel */
.today-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md); flex-wrap: wrap; }
.today-head h3 { font-size: var(--t-18); font-weight: 700; }
.today-head span { font-size: var(--t-14); color: var(--muted-fg); }
.route { list-style: none; padding: 0; margin: var(--space-lg) 0 0; display: grid; }
.leg { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: var(--space-md); align-items: start; position: relative; padding-bottom: var(--space-lg); }
.leg:last-child { padding-bottom: 0; }
.leg::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; border-left: 2px dashed var(--sky); }
.leg.done::before { border-left: 2px solid var(--archive); }
.leg:last-child::before { display: none; }
.node { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--sky); color: var(--sky-ink); }
.leg.done .node { background: var(--archive); border-color: var(--archive); color: var(--card); }
.leg.now .node { background: var(--sun); border-color: var(--sun); color: var(--on-sun); box-shadow: 0 0 0 5px color-mix(in srgb, var(--sun) 25%, transparent); }
.node .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.leg b { display: block; color: var(--fg-strong); font-weight: 650; }
.leg small { color: var(--muted-fg); font-size: var(--t-14); }
.leg .t { font-size: var(--t-14); color: var(--muted-fg); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-lg); margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--hair); font-size: var(--t-14); color: var(--muted-fg); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 28px; height: 0; border-top: 2px dashed var(--sky); }
.legend i.solid { border-top: 2px solid var(--archive); }

/* archive shelf */
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
@media (max-width: 900px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .shelf { grid-template-columns: minmax(0, 1fr); } }
.trip { background: var(--card); border-radius: var(--r-lg); border: 1px solid var(--hair); box-shadow: none; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; cursor: pointer; transition: box-shadow 200ms var(--ease), transform 200ms var(--ease); }
.trip:hover { border-color: var(--archive); }
.trip svg.map { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; max-width: 100%; background: var(--archive-tint); }
.trip .map .land { fill: color-mix(in srgb, var(--archive) 14%, var(--card)); }
.trip .map .path { fill: none; stroke: var(--archive); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trip .map .pt { fill: var(--card); stroke: var(--archive); stroke-width: 2.5; }
.trip-body { padding: var(--space-md) var(--space-lg) var(--space-lg); display: grid; gap: 6px; }
.trip-date { font-size: var(--t-14); color: var(--archive); font-weight: 650; display: inline-flex; gap: 6px; align-items: center; }
.trip-date .icon { width: 16px; height: 16px; }
.trip h3 { font-size: var(--t-22); font-weight: 750; }
.trip-stats { display: flex; gap: var(--space-md); flex-wrap: wrap; font-size: var(--t-14); color: var(--muted-fg); margin-top: 4px; }
.trip-stats span { display: inline-flex; align-items: center; gap: 4px; }
.trip-stats .icon { width: 16px; height: 16px; }

/* final CTA */
.finale { border-radius: var(--r-xl); padding: var(--space-3xl) var(--space-lg); background: var(--sky-tint); text-align: center; }
.finale h2 { font-size: var(--t-40); font-weight: 800; }
.finale p { margin: var(--space-md) auto 0; max-width: 32em; color: var(--muted-fg); font-size: var(--t-18); }
.invite { margin: var(--space-xl) auto 0; display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: center; max-width: 560px; }
.invite label { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: var(--space-sm); background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 14px; min-height: 48px; text-align: left; }
.invite input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: var(--t-16); color: var(--fg-strong); padding: 12px 0; }
.invite input:focus { outline: none; }
.invite label:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 25%, transparent); }
.copied { min-height: 24px; margin-top: var(--space-sm); font-size: var(--t-14); color: var(--archive); font-weight: 600; }

footer { padding-block: var(--space-2xl); color: var(--muted-fg); font-size: var(--t-14); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-md); border-top: 1px solid var(--hair); padding-top: var(--space-lg); }

/* entrance: visible at rest, gentle stagger on load */
.rise { }
.rise:nth-child(2) { animation-delay: 60ms; } .rise:nth-child(3) { animation-delay: 120ms; } .rise:nth-child(4) { animation-delay: 180ms; }
@keyframes rise { from { opacity: .001; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
