/* ============================================================
   Taylor's Bookshelf - Toss-inspired minimal UI, green palette
   ============================================================ */

:root {
  /* Green scale (primary) */
  --green-50:  #E9F9F1;
  --green-100: #CFF2E1;
  --green-200: #9FE5C4;
  --green-300: #5FD3A0;
  --green-400: #22C384;
  --green-500: #00B871;   /* primary */
  --green-600: #00A063;
  --green-700: #008551;
  --green-900: #0B4A32;

  /* Neutrals (Toss-like grays) */
  --gray-50:  #F9FAFB;
  --gray-100: #F2F4F6;
  --gray-200: #E5E8EB;
  --gray-300: #D1D6DB;
  --gray-400: #B0B8C1;
  --gray-500: #8B95A1;
  --gray-600: #6B7684;
  --gray-700: #4E5968;
  --gray-800: #333D4B;
  --gray-900: #191F28;

  --red-500: #F04452;

  --bg:        #FFFFFF;
  --bg-subtle: var(--gray-50);
  --text:      var(--gray-900);
  --text-2:    var(--gray-600);
  --text-3:    var(--gray-500);
  --line:      var(--gray-200);

  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow:    0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);

  --header-h: 64px;
  --maxw: 1120px;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
               "Segoe UI", Roboto, "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  letter-spacing: -0.3px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.8px; line-height: 1.32; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; letter-spacing: inherit; color: inherit; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------------- Header ---------------- */

.header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header__inner {
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.brand__name { font-size: 18px; font-weight: 700; letter-spacing: -0.7px; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav__link {
  display: inline-flex; align-items: center; height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; color: var(--text-2);
  transition: background .15s var(--ease), color .15s var(--ease);
  cursor: pointer; border: 0; background: transparent;
}
.nav__link:hover { background: var(--gray-100); color: var(--text); }
.nav__link.is-active { color: var(--green-600); background: var(--green-50); }
.nav__sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px;
  border: 0; border-radius: var(--radius);
  font-size: 16px; font-weight: 700; letter-spacing: -0.4px;
  cursor: pointer;
  transition: background .15s var(--ease), transform .08s var(--ease), opacity .15s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn--primary { background: var(--green-500); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--green-600); }

.btn--soft { background: var(--green-50); color: var(--green-700); }
.btn--soft:hover:not(:disabled) { background: var(--green-100); }

.btn--ghost { background: var(--gray-100); color: var(--gray-700); }
.btn--ghost:hover:not(:disabled) { background: var(--gray-200); }

.btn--danger { background: var(--gray-100); color: var(--red-500); }
.btn--danger:hover:not(:disabled) { background: #FDECEE; }

.btn--block { width: 100%; }
.btn--sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: var(--radius-sm); }
.btn--lg { height: 56px; font-size: 17px; border-radius: 16px; }

/* ---------------- Forms ---------------- */

.field { margin-bottom: 18px; }
.field__label {
  display: block; margin-bottom: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
}
.field__hint { margin-top: 7px; font-size: 13px; color: var(--text-3); line-height: 1.5; }

.input, .textarea, .select {
  width: 100%; padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: 16px; color: var(--text);
  outline: none;
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--gray-400); }
.input:focus, .textarea:focus, .select:focus {
  background: #fff; border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-50);
}
.input:disabled { color: var(--text-3); background: var(--gray-100); }
.textarea { min-height: 132px; resize: vertical; line-height: 1.65; }

/* ---------------- Cards & layout ---------------- */

.section { padding: 40px 0 72px; }

.hero { padding: 60px 0 36px; }
.hero__title { font-size: 38px; letter-spacing: -1.6px; }
.hero__sub { margin-top: 12px; font-size: 17px; color: var(--text-2); }
.hero__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.panel {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-xl); padding: 32px;
  box-shadow: var(--shadow-sm);
}
.panel--narrow { max-width: 440px; margin: 0 auto; }
.panel--form { max-width: 640px; margin: 0 auto; }
.panel__title { font-size: 24px; letter-spacing: -1px; }
.panel__desc { margin-top: 8px; font-size: 15px; color: var(--text-2); line-height: 1.6; }
.panel__head { margin-bottom: 26px; }

/* Book grid */

.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}

.card {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  cursor: pointer; text-align: left; padding: 0; font-family: inherit;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--green-200); }

.card__cover {
  position: relative; aspect-ratio: 3 / 4; background: var(--green-50);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card__cover img { width: 100%; height: 100%; object-fit: cover; }
.card__cover--empty { color: var(--green-300); font-size: 13px; font-weight: 700; }

.card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card__title {
  font-size: 16px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__author { font-size: 13.5px; color: var(--text-2); }
.card__note {
  margin-top: 4px; font-size: 13.5px; color: var(--text-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__meta {
  margin-top: auto; padding-top: 12px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-3);
}

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--green-50); color: var(--green-700);
  font-size: 12.5px; font-weight: 600;
}

/* Empty / loading states */

.empty { padding: 72px 24px; text-align: center; }
.empty__icon { width: 56px; height: 56px; margin: 0 auto 18px; opacity: .9; }
.empty__title { font-size: 18px; font-weight: 700; }
.empty__desc { margin-top: 8px; font-size: 15px; color: var(--text-2); line-height: 1.6; }

.skeleton { background: var(--gray-100); border-radius: var(--radius-lg); animation: pulse 1.4s ease-in-out infinite; }
.skeleton--card { aspect-ratio: 3 / 4.6; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .5 } }

.spinner {
  width: 18px; height: 18px; flex: none;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner--dark { border-color: var(--gray-200); border-top-color: var(--green-500); }
@keyframes spin { to { transform: rotate(360deg) } }

/* Alerts */

.alert {
  padding: 13px 16px; border-radius: var(--radius);
  font-size: 14.5px; line-height: 1.55; margin-bottom: 18px;
}
.alert--error { background: #FEF0F1; color: #C9333E; }
.alert--info { background: var(--green-50); color: var(--green-700); }
.alert--warn { background: #FFF7E6; color: #96690A; }
.alert code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 5px; font-size: 13px; }

/* Upload dropzone */

.dropzone {
  position: relative; display: block; width: 100%;
  border: 2px dashed var(--green-200); border-radius: var(--radius-lg);
  background: var(--green-50);
  padding: 44px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--green-500); background: var(--green-100); }
.dropzone__title { font-size: 16px; font-weight: 700; color: var(--green-700); }
.dropzone__desc { margin-top: 6px; font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.dropzone input[type="file"] { display: none; }

.preview {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 18px; background: var(--gray-50); border-radius: var(--radius-lg);
}
.preview__img {
  width: 108px; height: 144px; flex: none; object-fit: cover;
  border-radius: var(--radius); background: var(--gray-200);
}
.preview__info { flex: 1; min-width: 0; }

/* Camera */

.camera { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #000; }
.camera video { width: 100%; display: block; max-height: 420px; object-fit: cover; }
.camera__hint {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: #fff; font-size: 13.5px; text-align: center;
}

/* Book detail modal */

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0, 0, 0, .45);
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0 } }
.modal__box {
  position: relative;
  width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: var(--radius-xl); padding: 32px;
  box-shadow: var(--shadow-lg); animation: rise .22s var(--ease);
}
@keyframes rise { from { transform: translateY(14px); opacity: 0 } }
.modal__close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: var(--gray-100); color: var(--text-2); cursor: pointer; font-size: 17px; line-height: 1;
}
.modal__close:hover { background: var(--gray-200); }
.modal__head { display: flex; gap: 22px; margin-bottom: 24px; padding-right: 40px; }
.modal__cover { width: 150px; flex: none; border-radius: var(--radius); object-fit: cover; aspect-ratio: 3/4; background: var(--gray-100); }

.detail-desc { font-size: 15px; color: var(--text-2); line-height: 1.72; white-space: pre-wrap; }
.detail-note {
  padding: 18px; background: var(--green-50);
  border-radius: var(--radius); font-size: 15px; line-height: 1.75;
  color: var(--green-900); white-space: pre-wrap;
}
.detail-block { margin-top: 26px; }
.detail-block__label { font-size: 13px; font-weight: 700; color: var(--text-3); margin-bottom: 10px; }

/* Info table (Toss-like, borderless rows) */

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 13px 0; text-align: left; font-size: 15px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.table th { width: 116px; font-weight: 600; color: var(--text-3); }
.table td { color: var(--text); word-break: break-word; }
.table tr:last-child th, .table tr:last-child td { border-bottom: 0; }

/* Toast */

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 200; padding: 14px 22px; border-radius: 999px;
  background: var(--gray-900); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: rise .2s var(--ease);
  max-width: calc(100% - 40px); text-align: center;
}

/* Footer */

.footer {
  border-top: 1px solid var(--line); padding: 32px 0 48px;
  font-size: 13.5px; color: var(--text-3);
}

/* Utilities */

.stack-8 > * + * { margin-top: 8px; }
.stack-12 > * + * { margin-top: 12px; }
.stack-16 > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; }
.row--end { justify-content: flex-end; }
.row--wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.link { color: var(--green-600); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }
.divider { height: 1px; background: var(--line); margin: 26px 0; border: 0; }

/* Responsive */

@media (max-width: 720px) {
  .hero { padding: 40px 0 24px; }
  .hero__title { font-size: 28px; letter-spacing: -1.1px; }
  .hero__sub { font-size: 15px; }
  .panel { padding: 24px 20px; border-radius: var(--radius-lg); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 14px; }
  .card__body { padding: 13px 14px 15px; }
  .card__title { font-size: 14.5px; }
  .modal__box { padding: 24px 20px; max-height: 92vh; }
  .modal__head { flex-direction: column; gap: 16px; padding-right: 0; }
  .modal__cover { width: 128px; }
  .brand__name { font-size: 16px; }
  .nav__link { padding: 0 10px; font-size: 14px; }
  .preview { flex-direction: column; }
  .table th { width: 92px; font-size: 14px; }
  .table td { font-size: 14px; }
}
