* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0b1020;
  --bg-mid: #121b2d;
  --panel: rgba(17, 24, 39, 0.74);
  --panel-light: rgba(255, 255, 255, 0.08);
  --text: #edf6ff;
  --muted: #c9d7ef;
  --accent: #7dd3fc;
  --accent-2: #a78bfa;
  --accent-3: #f9a8d4;
  --success: #34d399;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
  --border: rgba(255, 255, 255, 0.12);
  --radius: 22px;
  --topbar-height: 76px;
  /* Rubik has no Armenian letters, so Armenian text uses the Noto Armenian fonts */
  --font-body: "Rubik", "Noto Sans Armenian", sans-serif;
  --font-display: "Noto Serif Armenian", "Rubik", serif;
}

html {
  /* Slide-in animations start slightly off-screen; never let them cause sideways scrolling */
  overflow-x: clip;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(125, 211, 252, 0.18), transparent 28%),
    radial-gradient(circle at right, rgba(167, 139, 250, 0.15), transparent 30%),
    linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-mid) 100%);
  min-height: 100vh;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Text for screen readers and search engines that is not shown on screen */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  background: rgba(11, 16, 32, 0.6);
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(125, 211, 252, 0.42);
}

.main-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.main-nav a {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 8px 0;
  transition: color 0.2s ease, background 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--text);
}

/* ☰ menu button, shown only on phones and tablets (see the media queries below) */
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-bar {
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

main {
  padding-bottom: 72px;
}

.site-footer {
  padding: 30px 0 48px;
  border-top: 1px solid var(--border);
  background: rgba(9, 13, 22, 0.6);
}

.footer-wrap {
  display: flex;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.section-heading {
  margin-bottom: 26px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(1.75rem, 0.9rem + 4vw, 4.5rem);
  margin-bottom: 18px;
}

h2 {
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.8rem);
}

h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.button:active {
  transform: scale(0.98);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07111c;
  box-shadow: 0 18px 36px rgba(125, 211, 252, 0.32);
}

.button.secondary {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.page-shell {
  padding: 52px 0 15px;
}

.page-hero {
  position: relative;
  padding: 32px 0 18px;
}

.page-hero > :not(.page-mark) {
  position: relative;
  z-index: 1;
}

/* Each section's emoji floats faintly behind its title */
.page-mark {
  position: absolute;
  top: 50%;
  right: 4%;
  font-size: clamp(4.5rem, 3rem + 8vw, 9rem);
  line-height: 1;
  opacity: 0.16;
  rotate: -12deg;
  translate: 0 -50%;
  pointer-events: none;
  user-select: none;
}

.page-title {
  font-size: clamp(1.75rem, 0.9rem + 4vw, 4rem);
  margin-bottom: 12px;
}

.page-subtitle {
  max-width: 760px;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1rem);
  line-height: 1.6;
  color: var(--muted);
}

.content-panel {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* A book's cover artwork (home page, book page): book-like corners, a light spine edge and a soft shadow */
.cover-art {
  display: block;
  justify-self: center;
  width: min(100%, 300px);
}

.cover-art img {
  width: 100%;
  height: auto;
  border-left: 3px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px 16px 16px 5px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.6);
  transition: transform 0.3s ease;
}

.cover-art figcaption {
  margin-top: 16px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

@media (hover: hover) {
  a.cover-art:hover img {
    transform: translateY(-4px) rotate(-1deg);
  }
}

/* Drawn book cover, for books that have no cover artwork yet: spine on the left, title, author at the bottom */
.book-cover {
  position: relative;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  justify-self: center;
  width: min(100%, 300px);
  aspect-ratio: 3 / 4;
  padding: 28px 24px 24px 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px 20px 20px 6px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.92), rgba(59, 130, 246, 0.8), rgba(15, 23, 42, 0.8));
  box-shadow:
    inset 14px 0 0 rgba(15, 23, 42, 0.28),
    inset 16px 0 0 rgba(255, 255, 255, 0.14),
    0 24px 50px rgba(15, 23, 42, 0.55);
  overflow: hidden;
}

.cover-heading {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cover-part {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fde68a;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.cover-part::before {
  content: '';
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.book-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  pointer-events: none;
}

.cover-author {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-weight: 500;
}

.book-cover .cover-title {
  position: relative;
  z-index: 1;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  /* Sized from the cover's width so the longest word («Արկածասեր») always fits whole */
  font-size: clamp(1.1rem, 14cqi, 2.1rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: normal;
  word-break: keep-all;
}

/* Gallery: 1 column on phones, 2 on tablets, 3 on wide screens */
.gallery-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.gallery-item {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.gallery-visual {
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--border);
}

/* Real photos fill the picture area */
.gallery-visual img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-visual:has(img) {
  min-height: 0;
}

/* A book cover in a gallery card is shown whole, standing like a book */
.gallery-visual .gallery-cover {
  width: auto;
  height: 230px;
  aspect-ratio: 765 / 1024;
  margin: 24px auto;
  object-fit: contain;
  border-radius: 4px 10px 10px 4px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.gallery-item figcaption {
  padding: 18px 18px 20px;
}

/* A section with no work yet: an honest note instead of made-up examples */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px 44px;
  text-align: center;
}

.empty-orb {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fef3c7 0%, #e0f2fe 16%, #7dd3fc 35%, #a78bfa 70%, #1f2937 100%);
}

.empty-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
}

.empty-state p:not(.empty-title) {
  max-width: 420px;
  color: var(--muted);
  line-height: 1.6;
}

.gallery-item h3 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.gallery-item p {
  color: var(--muted);
  line-height: 1.6;
}

.gallery-action {
  margin-top: 16px;
}

@media (hover: hover) {
  .button:hover {
    transform: translateY(-2px);
  }
}

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  /* A card left alone on the last row (or the only card) fills the row, picture beside text */
  .gallery-grid .gallery-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    align-items: center;
  }

  .gallery-grid .gallery-item:last-child:nth-child(odd) .gallery-visual {
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }

  .gallery-grid .gallery-item:last-child:nth-child(odd) figcaption {
    padding: 24px 28px;
  }
}

@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
  }

  /* Three columns: an odd last card is a normal card again, unless it is the only one */
  .gallery-grid .gallery-item:last-child:nth-child(odd):not(:only-child) {
    grid-column: auto;
    display: block;
  }

  .gallery-grid .gallery-item:last-child:nth-child(odd):not(:only-child) .gallery-visual {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .gallery-grid .gallery-item:last-child:nth-child(odd):not(:only-child) figcaption {
    padding: 18px 18px 20px;
  }
}

/* Phones and tablets: compact top bar with the ☰ menu */
@media (max-width: 899.98px) {
  :root {
    --topbar-height: 64px;
  }

  .nav-wrap {
    flex-wrap: wrap;
    gap: 12px;
  }

  /* Without JavaScript the links simply wrap under the logo */
  .main-nav {
    gap: 4px 16px;
    padding-bottom: 8px;
  }

  .js .nav-wrap {
    flex-wrap: nowrap;
  }

  .js .nav-toggle {
    display: inline-flex;
  }

  .js .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    max-height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    padding: 10px 16px 18px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .js.nav-open .main-nav,
  .nav-open .main-nav {
    display: flex;
  }

  .js .main-nav a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 1.05rem;
  }

  .js .main-nav a.active {
    background: rgba(255, 255, 255, 0.07);
  }
}

/* Phones */
@media (max-width: 599.98px) {
  main {
    padding-bottom: 48px;
  }

  .section-heading {
    margin-bottom: 18px;
  }

  .page-shell {
    padding-top: 24px;
  }

  .page-hero {
    padding: 16px 0 12px;
  }

  .gallery-visual {
    min-height: 150px;
  }

  .site-footer {
    padding: 24px 0 32px;
    font-size: 0.9rem;
  }

  .book-cover {
    width: min(100%, 230px);
    padding: 22px 18px 18px 32px;
  }

  .cover-art {
    width: min(100%, 230px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
