/* v2 shared design system for visitor pages (index / gallery / about / guestbook). */
:root {
  --bg: #f8f8fb; --surface: #ffffff; --surface-2: #f1f1f6;
  --text: #16161c; --muted: #6b6b78; --border: #e7e7ee;
  --accent: #6d5efc; --accent-600: #5b4ce0; --accent-50: #efedff; --accent-2: #18c5a6;
  --shadow-sm: 0 1px 2px rgba(20,20,45,.06);
  --shadow-md: 0 4px 16px rgba(20,20,45,.08);
  --shadow-lg: 0 12px 40px rgba(20,20,45,.12);
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-pill: 999px;
  --fs-hero: clamp(30px,5.5vw,50px); --fs-h2: clamp(22px,3vw,28px); --fs-h3: 19px;
  --container: 1200px; --prose: 720px;
  /* category accent colors */
  --c-live: #5a8dee; --c-quiz: #e0567b; --c-event: #e0913a; --c-edu: #3aa66f; --c-site: #b07cf0; --c-lab: #6d5efc;
}
.dark {
  --bg: #0e0e13; --surface: #17171f; --surface-2: #1f1f29;
  --text: #f0f0f6; --muted: #9a9aab; --border: #2a2a35;
  --accent: #8b7dff; --accent-50: #211d3a;
  --shadow-sm: none; --shadow-md: 0 2px 10px rgba(0,0,0,.4); --shadow-lg: 0 8px 30px rgba(0,0,0,.55);
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #0e0e13; --surface: #17171f; --surface-2: #1f1f29;
    --text: #f0f0f6; --muted: #9a9aab; --border: #2a2a35;
    --accent: #8b7dff; --accent-50: #211d3a;
    --shadow-sm: none; --shadow-md: 0 2px 10px rgba(0,0,0,.4); --shadow-lg: 0 8px 30px rgba(0,0,0,.55);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  line-height: 1.6; letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.03em; margin: 0; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 11px 20px; border-radius: var(--r-pill); font-weight: 600; font-size: 15px;
  transition: transform .12s, box-shadow .12s, border-color .12s, background .12s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: var(--shadow-md); }
.btn.primary:hover { background: var(--accent-600); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---- nav ---- */
#site-nav { position: sticky; top: 0; z-index: 40; min-height: 64px; }
.nav {
  min-height: 64px; display: flex; align-items: center; gap: 18px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
#site-nav.scrolled .nav { border-bottom-color: var(--border); }
.nav .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.nav .brand .dot { width: 13px; height: 13px; border-radius: 5px; background: var(--accent); }
.nav .spacer { flex: 1; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { padding: 8px 13px; border-radius: var(--r-sm); font-weight: 600; font-size: 14.5px; color: var(--muted); }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--accent); }
.icon-btn { width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.icon-btn:hover { border-color: var(--accent); }
.theme-btn { background: var(--surface-2); border-color: var(--accent); }
.theme-btn:hover { background: var(--accent-50); }
.theme-btn svg { display: block; }
.nav-toggle { display: none; }
@media (max-width: 760px) {
  .nav-links { position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px; transform: translateY(-120%); transition: transform .22s; }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 13px; }
  .nav-toggle { display: inline-flex; }
  .nav .cta-desktop { display: none; }
}

/* ---- hero ---- */
.hero { position: relative; overflow: hidden; padding: 72px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: var(--fs-hero); font-weight: 800; }
.hero .sub { color: var(--muted); font-size: clamp(16px,2vw,18px); margin: 18px 0 28px; max-width: 30ch; }
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-glow { position: absolute; top: -120px; right: -80px; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 65%); filter: blur(20px); pointer-events: none; z-index: 0; }
.hero-collage { position: relative; height: 340px; }
.hero-collage .shot { position: absolute; width: 62%; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); background: var(--surface-2); aspect-ratio: 16/10; }
.hero-collage .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-collage .s1 { top: 0; left: 2%; transform: rotate(-5deg); z-index: 3; }
.hero-collage .s2 { top: 70px; right: 0; transform: rotate(4deg); z-index: 2; }
.hero-collage .s3 { bottom: 0; left: 18%; transform: rotate(-1deg); z-index: 1; opacity: .92; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero .sub { max-width: none; } }
@media (max-width: 640px) { .hero-collage { display: none; } .hero { padding: 48px 0 40px; } }

/* ---- sections ---- */
.section { padding: 64px 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { font-size: var(--fs-h2); font-weight: 800; }
.section-head .count { color: var(--muted); font-weight: 600; font-size: 15px; }
.section-head .cap { color: var(--muted); font-size: 14px; width: 100%; margin-top: 2px; }
.section-head .more { margin-left: auto; font-weight: 600; color: var(--accent); font-size: 14.5px; }

/* ---- card grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .thumb { aspect-ratio: 16/10; position: relative; overflow: hidden; background: var(--surface-2); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; z-index: 1; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.04); }
.card .fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.cat-icon { width: 30%; max-width: 76px; height: auto; opacity: .92; }
.card .cat-chip { position: absolute; top: 10px; left: 10px; z-index: 2; padding: 4px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; color: #fff; backdrop-filter: blur(4px); }
.card .type-badge { position: absolute; top: 10px; right: 10px; z-index: 2; padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; background: rgba(0,0,0,.5); color: #fff; }
.card-body { padding: 15px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-title { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-summary { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: auto; }
.chip { background: var(--surface-2); color: var(--muted); font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); }
.card--lg .card-title { font-size: 17px; }
.card--lg .card-summary { -webkit-line-clamp: 3; }

/* ---- filters ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.search { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 10px 16px; color: var(--text); outline: none; min-width: 200px; flex: 1; max-width: 360px; }
.search:focus { border-color: var(--accent); }
.pill { border: 1px solid var(--border); background: var(--surface); padding: 7px 14px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600; color: var(--muted); }
.pill.active { background: var(--accent); color: #fff; border-color: transparent; }
.tagbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tag { border: 1px solid var(--border); background: var(--surface-2); padding: 4px 11px; border-radius: var(--r-pill); font-size: 12.5px; color: var(--muted); }
.tag.active { background: var(--accent); color: #fff; border-color: transparent; }
.tag .n { opacity: .6; margin-left: 5px; }

/* ---- reveal motion ---- */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .5s ease-out, transform .5s ease-out; transition-delay: var(--reveal-delay, 0ms); }
[data-reveal].in { opacity: 1; transform: none; }

/* ---- footer ---- */
#site-footer { border-top: 1px solid var(--border); margin-top: 40px; background: var(--surface); }
.footer { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; padding: 48px 0 28px; }
.footer h4 { font-size: 13px; color: var(--muted); font-weight: 700; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; }
.footer a { color: var(--muted); display: block; padding: 4px 0; font-size: 14px; }
.footer a:hover { color: var(--accent); }
.footer .brand { font-weight: 800; font-size: 16px; display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.footer .brand .dot { width: 11px; height: 11px; border-radius: 4px; background: var(--accent); }
.footer .mission { color: var(--muted); font-size: 13.5px; max-width: 34ch; }
.footer-legal { border-top: 1px solid var(--border); padding: 16px 0; color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .footer { grid-template-columns: 1fr 1fr; } }

/* ---- modal viewer ---- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,8,18,.6); }
.modal-panel { position: absolute; inset: 4vh 4vw; background: var(--surface); border-radius: var(--r-md); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal-panel.full { inset: 0; border-radius: 0; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head .title { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { flex: 1; overflow: auto; position: relative; background: var(--surface-2); }
.modal-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.code-view { margin: 0; padding: 18px; overflow: auto; height: 100%; font-size: 13px; font-family: 'JetBrains Mono', Consolas, monospace; }
.copybar { position: absolute; top: 12px; right: 18px; }

/* ---- misc states ---- */
.state { text-align: center; padding: 64px 20px; color: var(--muted); }
.state h3 { color: var(--text); margin: 0 0 6px; }
.shimmer { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sh 1.3s ease infinite; }
@keyframes sh { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--r-sm); font-weight: 600; opacity: 0; transition: opacity .2s; z-index: 80; pointer-events: none; }
.toast.show { opacity: 1; }
.hide { display: none !important; }
.prose { max-width: var(--prose); }
.prose p { white-space: pre-wrap; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .card, .card .thumb img, .btn { transition: none !important; }
}
