/*
 * Ceritera V8.1 — Phase 1 application of the design foundation.
 * This layer intentionally changes visual language only; no reader/import logic.
 */

header {
  background: color-mix(in srgb, var(--surface-paper) 94%, transparent);
  border-bottom: var(--border-strong) solid var(--text-primary);
  padding: var(--space-5) var(--gutter-desktop);
}

.brand { gap: var(--space-3); }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-xs);
  border: var(--border-strong) solid var(--text-primary);
  background: var(--action-primary);
  color: #fff;
  box-shadow: 3px 3px 0 var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  text-transform: none;
}

.tagline {
  margin-top: var(--space-1);
  font-family: var(--font-label);
  font-size: var(--text-2xs);
  font-weight: 800;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.icon-toggle-btn,
#exitFocusBtn,
button,
select,
input[type="text"] {
  border-radius: var(--radius-sm);
  border: var(--border-hairline) solid var(--border-subtle);
  box-shadow: var(--shadow-control);
}

.icon-toggle-btn {
  width: 40px;
  height: 40px;
  border-color: var(--text-primary);
}

button {
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}
button:active { transform: translateY(1px); }

input[type="text"],
.form-field input,
.form-field select,
.form-field textarea {
  border-radius: var(--radius-sm);
  border: var(--border-hairline) solid var(--border-subtle);
  background: var(--surface-paper);
  box-shadow: none;
}

input[type="text"]:focus,
select:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 2px solid var(--action-primary);
  outline-offset: 1px;
  box-shadow: none;
}

.app-dropdown-menu,
.modal {
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-raised);
}
.app-dropdown-item,
.app-dropdown-lang-chip,
.theme-swatch-item,
.theme-dark-row,
.btn-cancel,
.chapter-edit-block { border-radius: var(--radius-sm); }

main {
  max-width: var(--layout-content);
  padding: var(--space-8) var(--gutter-desktop) var(--space-16);
}

.lib-hero {
  border: var(--border-strong) solid var(--text-primary);
  border-radius: var(--radius-sm);
  box-shadow: 6px 6px 0 color-mix(in srgb, var(--action-primary) 75%, var(--text-primary));
}

.lib-hero-cover {
  position: relative;
  isolation: isolate;
  min-height: 250px;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--action-primary-soft) 78%, var(--surface-paper)), var(--action-primary-soft));
  filter: none;
}
.lib-hero-cover::before {
  content: 'CERITERA';
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  z-index: -1;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--text-primary);
}
.lib-hero-cover::after {
  content: 'Edisi Digital';
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  padding: var(--space-1) var(--space-2);
  border: var(--border-hairline) solid var(--text-primary);
  background: var(--surface-paper);
  font-family: var(--font-label);
  font-size: var(--text-2xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lib-hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.85rem);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-transform: none;
  text-wrap: balance;
}
.lib-hero-desc {
  font-family: var(--font-reading);
  font-size: var(--text-md);
  line-height: 1.65;
}
.lib-hero-stats-num { font-family: var(--font-display); font-weight: 700; }

.section-kicker,
.lib-hero-kicker,
.lib-hero-stats-label,
.book-card-tagchip,
.book-meta,
.book-tag,
.chapter-indicator-box .chi-num,
.chapter-indicator-box .chi-of,
.page-indicator,
.swipe-hint,
footer {
  font-family: var(--font-label);
  letter-spacing: var(--tracking-label);
}

.section-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 6vw, 4.75rem);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-transform: none;
}
.section-note {
  font-family: var(--font-reading);
  font-size: var(--text-md);
  line-height: 1.65;
}

.book-grid { gap: var(--space-6) var(--space-5); }
.book-card {
  border: var(--border-hairline) solid var(--text-primary);
  border-radius: var(--radius-sm);
  background: var(--surface-paper);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--text-primary) 15%, transparent);
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-cover);
}
.book-card:not(.book-card--feature) .book-card-cover { aspect-ratio: var(--cover-ratio); }
.book-card--feature .book-card-cover { aspect-ratio: 16 / 8; }
.book-card-cover {
  isolation: isolate;
  min-height: 0;
  background:
    radial-gradient(circle at 72% 28%, color-mix(in srgb, var(--action-secondary) 45%, transparent), transparent 32%),
    linear-gradient(155deg, var(--action-primary-soft), color-mix(in srgb, var(--surface-paper) 50%, var(--action-primary-soft)));
  border-bottom: var(--border-hairline) solid var(--text-primary);
}
.book-card-cover::before {
  content: 'CERITERA';
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  right: var(--space-3);
  z-index: -1;
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 1.6vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
}
.book-card-cover::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 12%;
  height: var(--border-strong);
  background: var(--action-primary);
  opacity: 0.9;
}
.book-card-icon {
  font-size: clamp(2.75rem, 6vw, 4.75rem);
  filter: drop-shadow(0 8px 14px rgba(28, 26, 22, 0.16));
}
.book-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.15;
  text-transform: none;
  text-wrap: balance;
}
.book-card--feature .book-title { font-size: clamp(1.25rem, 3vw, 1.8rem); }
.book-card-body { padding: var(--space-4); }

.reader-nav {
  border-bottom: var(--border-hairline) solid var(--border-subtle);
}
#readerTitle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-transform: none;
  text-wrap: balance;
}
#readerAuthor { font-family: var(--font-reading); font-size: var(--text-md); }
.chapter-indicator-box {
  border: var(--border-hairline) solid var(--text-primary);
  border-radius: var(--radius-xs);
}
.reader-content {
  font-family: var(--font-reading);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  transition:
    transform var(--duration-page) var(--ease-emphasized),
    filter var(--duration-page) ease;
}
.reader-content p { margin-bottom: var(--reader-paragraph-gap); }
.reader-content > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 700;
}
.progress-track { height: 3px; border-radius: 0; }
.progress-fill { border-radius: 0; }

body.reading main {
  background: var(--surface-paper);
  border-inline: var(--border-hairline) solid var(--border-subtle);
}

footer { border-top: var(--border-hairline) solid var(--border-subtle); }

@media (max-width: 720px) {
  header { padding: var(--space-4) var(--gutter-mobile); }
  .brand-mark { width: 38px; height: 38px; }
  main { padding: var(--space-6) var(--gutter-mobile) var(--space-12); }
  .lib-hero { box-shadow: 4px 4px 0 color-mix(in srgb, var(--action-primary) 75%, var(--text-primary)); }
  .lib-hero-cover { min-height: 210px; }
  .book-grid { gap: var(--space-4) var(--space-3); }
  body.reading main { border-inline: 0; }
}

.section-headline,
.section-note,
#readerTitle,
#readerAuthor { margin-top: 0; }
.section-headline { margin-bottom: 0; }
.section-note { margin-bottom: var(--space-1); }
#readerAuthor { margin-bottom: 0; }

/* Keep the cover masthead clear of the language tag and delete control on compact cards. */
.book-card-cover::before {
  top: 2.15rem;
  font-size: clamp(0.64rem, 1.1vw, 0.82rem);
}
