/* ELK e-Book Library — shared styles */
@font-face {
  font-family: "Pretendard";
  src: url("../fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-display: swap;
}

:root {
  /* palette from the ELK e·BOOK logo: purple #6460AB (ELK) · coral #F05A72 (e) · blue #659AD2 (BOOK).
     Darkened where white text sits on them so contrast stays at 4.5:1 or more. */
  --ink: #1d1c30;
  --ink-2: #44435c;
  --ink-3: #6d6c86;
  --line: #e4e3ee;
  --line-2: #d1d0e0;
  --bg: #ffffff;
  --bg-2: #f6f6fa;
  --bg-3: #ecebf4;
  --brand: #56519c;        /* logo purple, button-safe */
  --brand-hover: #46418a;
  --brand-deep: #2e2b57;   /* card title bars, dark panels */
  --brand-logo: #6460ab;
  --brand-2: #3a72b0;      /* logo blue, link-safe */
  --brand-soft: #efeef8;
  --blue-soft: #eaf2fb;
  --accent: #d9435e;       /* logo coral, button-safe */
  --accent-logo: #f05a72;
  --accent-soft: #fdecef;
  --ok: #2f8f6b;
  --danger: #d9435e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(46, 43, 87, .06), 0 4px 16px rgba(46, 43, 87, .07);
  --shadow-lg: 0 12px 40px rgba(46, 43, 87, .2);
  --wrap: 1200px;
  --gutter: 24px;
  --header-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Pretendard", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg);
  word-break: keep-all;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 1000; padding: 10px 16px; background: var(--brand-deep); color: #fff; border-radius: 8px; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: 64px 0; }
.section + .section { padding-top: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.section-head .more { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border: 1px solid var(--brand); border-radius: 99px; font-size: 15px; font-weight: 700; color: var(--brand); white-space: nowrap; transition: background .15s, color .15s; }
.section-head .more:hover { background: var(--brand); color: #fff; }
.muted { color: var(--ink-3); }
.badge-new { display: inline-block; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; vertical-align: middle; }

/* ---------- buttons, chips, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 20px; border-radius: 8px; border: 1px solid var(--line-2);
  background: #fff; font-weight: 600; font-size: 15px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.accent:hover { background: #c4374f; border-color: #c4374f; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn.block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn svg { width: 18px; height: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--line-2); background: #fff; font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .n { font-size: 12px; opacity: .6; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--bg-3); font-size: 13px; color: var(--ink-2); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--accent); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-size: 15px;
}
.textarea { height: auto; min-height: 140px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { position: relative; padding: 12px 0; font-size: 17px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.tabs [aria-selected="true"], .tabs .active { color: var(--brand); }
.tabs [aria-selected="true"]::after, .tabs .active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--brand); border-radius: 3px 3px 0 0; }
.tabs .n { font-size: 13px; color: var(--ink-3); margin-left: 4px; font-weight: 500; }

/* ---------- header ---------- */
.header { position: sticky; top: 0; z-index: 100; background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.cat-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; }
.cat-btn:hover, .cat-btn[aria-expanded="true"] { background: var(--bg-2); }
.cat-btn svg { width: 22px; height: 22px; }
.logo { display: flex; align-items: center; flex: none; }
.logo img { height: 46px; width: auto; }
.org-logo-img { width: auto; max-width: 100%; object-fit: contain; }
.footer-right { text-align: right; display: grid; justify-items: end; gap: 2px; }
.footer-right img { height: 36px; width: auto; margin-bottom: 8px; }
.gnb { display: flex; gap: 4px; margin-left: 12px; }
.gnb a { white-space: nowrap; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 15px; color: var(--ink-2); }
.gnb a:hover { background: var(--bg-2); color: var(--ink); }
.gnb a[aria-current="page"] { color: var(--brand); box-shadow: inset 0 -3px 0 var(--accent-logo); border-radius: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg-2); }
.m-only { display: none !important; }

/* mega menu (categories: type → group → organisation) */
.mega { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); display: none; }
.mega.open { display: block; }
.mega-cols { display: grid; grid-template-columns: 240px 260px 1fr; min-height: 380px; }
.mega-col { padding: 16px 12px; border-right: 1px solid var(--line); max-height: 60vh; overflow-y: auto; }
.mega-col:last-child { border-right: 0; }
.mega-col a, .mega-col button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; border-radius: 8px; font-size: 15px; text-align: left; }
.mega-col a:hover, .mega-col button:hover, .mega-col .on { background: var(--bg-2); }
.mega-col .on { font-weight: 700; }
.mega-col .n { font-size: 12px; color: var(--ink-3); }
.mega-col .org-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 12px; }
.mega-col h3 { display: flex; justify-content: space-between; padding: 6px 12px 10px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.org-row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.org-avatar { flex: none; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.org-avatar img { width: 100%; height: 100%; object-fit: cover; }
.org-dot { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }

/* ---------- footer ---------- */
.footer { margin-top: 80px; background: var(--bg-2); border-top: 1px solid var(--line); padding: 40px 0 48px; font-size: 14px; color: var(--ink-3); }
.footer-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 20px; margin-bottom: 14px; color: var(--ink-2); font-weight: 600; }
.footer address { font-style: normal; line-height: 1.8; }
.footer .tel { font-size: 24px; font-weight: 800; color: var(--ink); }

/* ---------- aiibook portfolio card (kept as-is from the reference, scaled to the grid) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px 28px; }
.card-grid.cols-5 { grid-template-columns: repeat(5, 1fr); gap: 32px 22px; }
.pf-card { position: relative; overflow: hidden; border-radius: 10px; box-shadow: 0 0 20px rgba(46, 43, 87, .18); transition: transform .3s ease, box-shadow .3s ease; background: var(--brand-deep); }
.pf-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(46, 43, 87, .28); }
.pf-img { position: relative; display: block; aspect-ratio: 240 / 310; overflow: hidden; background: var(--bg-3); }
.pf-card.horizontal .pf-img { aspect-ratio: 440 / 310; }
.pf-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.pf-card:hover .pf-img img { transform: scale(1.04); }
.pf-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
  padding: 20px; text-align: center; background: rgba(46, 43, 87, .72); opacity: 0; transition: opacity .3s ease;
}
/* keyboard focus only (:focus-visible): a mouse click on "e-Book 보기" leaves the button focused while the viewer opens in
   a new tab, and :focus-within kept the overlay up after coming back */
.pf-card:hover .pf-overlay, .pf-card:has(:focus-visible) .pf-overlay { opacity: 1; }
/* the overlay only shows; a click anywhere on it goes to the card's link underneath, except on the button */
.pf-overlay { pointer-events: none; }
.pf-overlay .view { pointer-events: auto; }
.pf-overlay .view { display: inline-block; padding: 8px 18px; border: 1.5px solid #fff; border-radius: 99px; color: #fff; font-weight: 700; font-size: 15px; }
.pf-overlay .view:hover { background: #fff; color: var(--brand-deep); }
.pf-overlay .tags { color: #fff; font-size: 13px; line-height: 1.5; text-shadow: 0 0 5px rgba(0, 0, 0, .8); }
.pf-info { position: relative; display: flex; align-items: center; min-height: 60px; padding: 10px 52px 10px 18px; background: var(--brand-deep); transition: background .3s ease; }
.pf-card:hover .pf-info { background: var(--brand); }
.pf-info h4 { font-size: 15px; font-weight: 500; line-height: 1.4; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pf-info h4 a:hover { text-decoration: underline; }
.pf-share { position: absolute; right: 16px; top: 50%; translate: 0 -50%; width: 24px; height: 24px; background: url("../img/btn-share-w.png") no-repeat center / contain; opacity: .5; transition: opacity .3s; }
.pf-share:hover, .pf-card:hover .pf-share { opacity: 1; }
.pf-lock { position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; z-index: 2; }
.pf-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--ink-3); padding: 0 2px; }

/* ---------- page heads ---------- */
.subvisual { background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 44px 0 36px; }
.subvisual h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span[aria-hidden] { opacity: .5; }

/* layout with a left local nav */
.with-lnb { display: grid; grid-template-columns: 220px 1fr; gap: 48px; padding-top: 48px; }
.lnb { align-self: start; position: sticky; top: calc(var(--header-h) + 24px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lnb h2 { padding: 16px 18px; background: var(--brand-deep); color: #fff; font-size: 16px; }
.lnb a { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); font-size: 15px; color: var(--ink-2); }
.lnb a:hover { background: var(--bg-2); }
.lnb a[aria-current="page"], .lnb a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.content h2.title { font-size: 26px; font-weight: 800; margin-bottom: 20px; letter-spacing: -.02em; }

/* ---------- modal, toast ---------- */
.modal { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 16px; background: rgba(29, 28, 48, .55); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px; }
.modal-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.modal-close { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; font-size: 26px; line-height: 1; color: var(--ink-3); }
.modal-close:hover { background: var(--bg-2); color: var(--ink); }
.share-row { display: flex; gap: 8px; margin: 18px 0 14px; }
.share-row .input { flex: 1; background: var(--bg-2); font-size: 14px; }
.share-qr { display: flex; gap: 18px; align-items: center; padding: 16px; border-radius: var(--radius); background: var(--bg-2); font-size: 14px; color: var(--ink-3); }
.share-qr #qr { flex: none; padding: 8px; background: #fff; border-radius: 8px; }
.share-qr #qr img, .share-qr #qr canvas { width: 104px; height: 104px; }
.toast { position: fixed; left: 50%; bottom: 32px; z-index: 600; translate: -50% 20px; padding: 12px 22px; border-radius: 99px; background: var(--brand-deep); color: #fff; font-size: 15px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; translate: -50% 0; }


/* ---------- mobile bottom bar ---------- */
.tabbar { display: none; }

/* empty / loading */
.empty { padding: 80px 0; text-align: center; color: var(--ink-3); }
.empty b { display: block; font-size: 18px; color: var(--ink); margin-bottom: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
    .gnb a { padding: 8px 9px; }
}
@media (max-width: 1100px) {
  .gnb { display: none; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .card-grid.cols-5 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; --header-h: 60px; }
  body { padding-bottom: 64px; }
  .section { padding: 44px 0; }
  .section-head h2 { font-size: 21px; }
  .section-head .more { height: 32px; padding: 0 12px; font-size: 13px; }
  .d-only { display: none !important; }
  .m-only { display: flex !important; }
  .header-inner { gap: 6px; }
  .logo { margin: 0 auto; }
  .header-inner::after { content: ""; width: 40px; flex: none; }  /* keeps the logo centred now the search icon is gone */
  .logo img { height: 38px; }
        /* no backdrop-filter here: it would make the header the containing block of the fixed menu */
  .header { backdrop-filter: none; background: #fff; }
  .mega { position: fixed; top: var(--header-h); bottom: 60px; overflow-y: auto; }
  .mega-cols { grid-template-columns: 1fr; min-height: 0; }
  .mega-col { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .mega-col .org-grid { grid-template-columns: 1fr; }
  .card-grid, .card-grid.cols-5 { grid-template-columns: repeat(2, 1fr); gap: 24px 14px; }
  .pf-info { min-height: 52px; padding: 8px 40px 8px 12px; }
  .pf-info h4 { font-size: 14px; }
  .pf-share { right: 12px; width: 20px; height: 20px; }
  .pf-overlay { display: none; }
  .subvisual { padding: 28px 0 22px; }
  .subvisual h1 { font-size: 26px; }
  .with-lnb { grid-template-columns: 1fr; gap: 20px; padding-top: 20px; }
  .lnb { position: static; display: flex; overflow-x: auto; border-radius: 99px; }
  .lnb h2 { display: none; }
  .lnb a { border-top: 0; white-space: nowrap; padding: 10px 16px; }
  .modal-card { padding: 26px 20px; border-radius: 14px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: grid; grid-template-columns: repeat(4, 1fr);
    height: 60px; padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--ink-3); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar [aria-current="page"] { color: var(--brand); font-weight: 700; }
  .footer { margin-top: 48px; }
  .footer-right { text-align: left; justify-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
