:root {
  --book-bg: #1c1917;
  --book-surface: #292524;
  --book-spine: #44403c;
  --book-page: #fafaf9;
  --book-shadow: rgba(0, 0, 0, 0.45);
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --text: #e7e5e4;
  --text-muted: #a8a29e;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
}

[data-theme='light'] {
  --book-bg: #f5f5f4;
  --book-surface: #e7e5e4;
  --book-spine: #d6d3d1;
  --book-shadow: rgba(0, 0, 0, 0.18);
  --text: #1c1917;
  --text-muted: #57534e;
}

[data-theme='light'] .header,
[data-theme='light'] .stepper { border-color: rgba(0, 0, 0, 0.08); }
[data-theme='light'] .header__home-btn { border-color: rgba(0, 0, 0, 0.15); }
[data-theme='light'] .header__home-btn:hover { border-color: rgba(0, 0, 0, 0.25); }
[data-theme='light'] .menu-btn,
[data-theme='light'] .theme-toggle { border: 1px solid rgba(0, 0, 0, 0.12); }

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--book-surface);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.header {
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  background: var(--book-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1.125rem;
  transition: opacity 0.2s;
}
.header__logo:hover { opacity: 0.85; }

.header__logo img {
  height: 32px;
  width: auto;
  display: block;
}

.header__home-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.header__home-btn:hover {
  background: var(--book-surface);
  color: var(--text);
}

.header__center {
  text-align: center;
  min-width: 0;
  justify-self: center;
}

.header__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header__intro {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Book view: yana açılan kitap alanı */
.book-view {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--book-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  gap: 0;
}

.book-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--book-surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--book-shadow);
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.book-nav:hover {
  background: var(--book-spine);
  transform: translateY(-50%) scale(1.05);
}

.book-nav:active {
  transform: translateY(-50%) scale(0.98);
}

.book-nav:disabled,
.book-nav[aria-disabled="true"] {
  opacity: 0.35;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.book-nav:disabled:hover,
.book-nav[aria-disabled="true"]:hover {
  transform: translateY(-50%);
}

.book-nav--prev {
  left: 1rem;
}

.book-nav--next {
  right: 1rem;
}

/* Mobilde büyük tıklanabilir alanlar */
.book-nav__tap-zone {
  display: none;
}

@media (max-width: 900px) {
  .book-nav__tap-zone {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    min-width: 60px;
    z-index: 4;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .book-nav__tap-zone--prev {
    left: 0;
  }

  .book-nav__tap-zone--next {
    right: 0;
  }
}

@media (max-width: 600px) {
  .book-nav__tap-zone {
    width: 48px;
    min-width: 48px;
  }
}

.book-nav__arrow {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.book-nav--prev .book-nav__arrow {
  margin-left: 2px;
  border-right: 6px solid currentColor;
}

.book-nav--next .book-nav__arrow {
  margin-right: 2px;
  border-left: 6px solid currentColor;
}

.book {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: min-content;
  filter: drop-shadow(0 25px 50px var(--book-shadow));
}

.book__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Spread görünümü */
.book__spread {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  transition: opacity 0.2s;
}

.book__spread:not(.book__spread--single) {
  flex-direction: row;
  align-items: stretch;
  gap: 0;
}

.book__spread:not(.book__spread--current) {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
}

.book__spread--current {
  position: relative;
}

.book__page--single {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(400px, calc(100vw - 3rem));
  aspect-ratio: 400 / 560;
  container-type: size;
  container-name: page;
  background: var(--book-page);
  color: #1c1917;
  border-radius: 8px;
  box-shadow: 0 4px 24px var(--book-shadow);
  overflow: hidden;
}

/* Mobilde sayfa canvas'ı orantılı ölçekle - masaüstü ile aynı görünüm */
@container page (max-width: 400px) {
  .book__page--single .page__wrapper {
    transform: scale(calc(100cqw / 400));
    transform-origin: center center;
  }
}

/* Masaüstü: çift sayfa sol | cilt | sağ */
.book__page--left,
.book__page--right {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 400px;
  min-width: 400px;
  min-height: 560px;
  background: var(--book-page);
  color: #1c1917;
  box-shadow: 0 4px 24px var(--book-shadow);
  overflow: hidden;
}

.book__page--left {
  border-radius: 8px 0 0 8px;
}

.book__page--right {
  border-radius: 0 8px 8px 0;
}

.book__spine {
  width: 8px;
  flex-shrink: 0;
  background: linear-gradient(90deg, #57534e 0%, var(--book-spine) 50%, #57534e 100%);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

[data-theme='light'] .book__spine {
  background: linear-gradient(90deg, #e7e5e4 0%, #fafaf9 50%, #e7e5e4 100%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.06);
}

.page__wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.page-canvas {
  position: relative;
  width: 100%;
  height: 100%;
}

.page-canvas__area {
  position: absolute;
  inset: 0;
}

.page-canvas__element {
  position: absolute;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.page-canvas__element--text {
  display: flex;
  align-items: flex-start;
  line-height: 1.35;
  word-wrap: break-word;
}

.page-canvas__element--text.single-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-canvas__element--image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-canvas__element--image img.obj-cover {
  object-fit: cover;
}

.page-canvas__element--image img.obj-fill {
  object-fit: fill;
}

.stepper {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: var(--book-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.stepper__text {
  font-size: 0.875rem;
  min-width: 4ch;
  color: var(--text-muted);
}

.stepper__progress {
  flex: 1;
  max-width: 140px;
  height: 6px;
  background: var(--book-spine);
  border-radius: 3px;
  overflow: hidden;
}

.stepper__progress-inner {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.25s ease;
}

.top-actions {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: var(--book-surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.2s;
  padding: 0;
}
.theme-toggle:hover {
  background: var(--book-spine);
}
.theme-toggle .theme-toggle__moon { display: none; }
.theme-toggle .theme-toggle__sun { display: inline; }
[data-theme='light'] .theme-toggle .theme-toggle__moon { display: inline; }
[data-theme='light'] .theme-toggle .theme-toggle__sun { display: none; }

.menu-btn {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--book-surface);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--book-shadow);
  transition: background 0.2s;
}

.menu-btn:hover {
  background: var(--book-spine);
}

.menu-btn__icon {
  width: 18px;
  height: 14px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: linear-gradient(to bottom, currentColor 0%, currentColor 2px, transparent 2px, transparent 4px, currentColor 4px, currentColor 6px, transparent 6px, transparent 8px, currentColor 8px, currentColor 10px, transparent 10px);
  background-size: 100% 14px;
}

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel:not([hidden]) {
  pointer-events: auto;
}

.menu-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.menu-panel__content {
  position: relative;
  background: var(--book-surface);
  padding: 1.75rem;
  border-radius: 16px;
  min-width: 260px;
  box-shadow: 0 24px 48px var(--book-shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.menu-panel__title {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.menu-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-panel__item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 0.35rem;
  font-size: 1rem;
  font-family: var(--font);
  text-align: left;
  background: var(--book-bg);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.menu-panel__item:hover {
  background: var(--book-spine);
  border-color: rgba(255, 255, 255, 0.08);
}

.footer {
  flex-shrink: 0;
  padding: 1.25rem 25px;
  min-height: 100px;
  background: var(--book-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}

[data-theme='light'] .footer {
  border-top-color: rgba(0, 0, 0, 0.06);
}

.footer__left {
  flex: 1;
  min-width: 180px;
  max-width: 100%;
  display: grid;
  grid-template-columns: 25% 1fr;
  gap: 1rem;
  align-items: flex-start;
}

.footer__logo-wrap {
  width: 100%;
}

.footer__logo-wrap img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 96px;
  object-fit: contain;
  object-position: left center;
  border-radius: 8px;
}

.footer__text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.footer__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  letter-spacing: -0.02em;
}

.footer__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.55;
  text-align: left;
  overflow-wrap: break-word;
  word-wrap: break-word;
  max-width: 100%;
}

.footer__right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.footer__right::before {
  content: "İletişim";
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.footer__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 152px;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-family: var(--font);
  font-weight: 500;
  color: #fff;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.footer__btn-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.footer__btn:hover {
  transform: translateY(-1px);
}

.footer__btn--wa {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.footer__btn--wa:hover {
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.45);
}

.footer__btn--ig {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  box-shadow: 0 2px 8px rgba(225, 48, 108, 0.35);
}

.footer__btn--ig:hover {
  box-shadow: 0 4px 14px rgba(225, 48, 108, 0.45);
}

[data-theme='light'] .footer__btn--wa {
  box-shadow: 0 2px 10px rgba(37, 211, 102, 0.4);
}

[data-theme='light'] .footer__btn--ig {
  box-shadow: 0 2px 10px rgba(225, 48, 108, 0.4);
}

.size-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.size-guide-overlay[hidden] {
  display: none;
}

.size-guide-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.size-guide-overlay__box {
  position: relative;
  width: 100%;
  max-width: 90vw;
  max-height: 85vh;
  background: var(--book-page);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px var(--book-shadow);
}

.size-guide-overlay__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.5rem;
  line-height: 1;
  background: var(--book-surface);
  color: var(--text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.size-guide-overlay__close:hover {
  background: var(--book-spine);
}

.size-guide-overlay__iframe {
  flex: 1;
  min-height: 400px;
  border: none;
}

/* Responsive: tablet ve altı */
@media (max-width: 900px) {
  .header {
    padding: 0.6rem 1rem;
  }

  .header__top {
    gap: 0.5rem;
  }

  .header__title {
    font-size: 1.1rem;
  }

  .header__intro {
    font-size: 0.75rem;
  }

  .header__logo img {
    height: 36px;
  }

  .book-view {
    padding: 1rem;
  }

  .book__page--single {
    width: min(360px, calc(100vw - 2rem));
  }

  .book-nav {
    width: 32px;
    height: 32px;
  }

  .book-nav__arrow {
    border-top-width: 4px;
    border-bottom-width: 4px;
  }

  .book-nav--prev .book-nav__arrow { border-right-width: 5px; }
  .book-nav--next .book-nav__arrow { border-left-width: 5px; }

  .book-nav--prev {
    left: 0.5rem;
  }

  .book-nav--next {
    right: 0.5rem;
  }

  .stepper {
    padding: 0.6rem 1rem;
  }

  .stepper__text {
    font-size: 0.8125rem;
  }

  .footer {
    padding: 1rem 20px;
  }

  .footer__left {
    grid-template-columns: 22% 1fr;
  }

  .footer__logo-wrap img {
    max-height: 88px;
  }

  .top-actions {
    top: 1rem;
    right: 1rem;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .menu-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* Responsive: mobil */
@media (max-width: 600px) {
  body {
    min-height: auto;
  }

  .header {
    padding: 0.5rem 1rem;
  }

  .header__top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .header__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .header__center {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-align: left;
  }

  .header__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header__intro {
    display: none;
  }

  .header__logo {
    flex-shrink: 0;
  }

  .header__logo img {
    height: 36px;
  }

  .header__home-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  /* Anasayfada "Anasayfaya dön" butonunu gizle */
  .page-is-home .header__home-btn {
    display: none !important;
  }

  .book-view {
    padding: 0.75rem;
  }

  .book__page--single {
    width: min(320px, calc(100vw - 1.5rem));
  }

  .book-nav {
    width: 28px;
    height: 28px;
    top: 50%;
  }

  .book-nav--prev {
    left: 0.25rem;
  }

  .book-nav--next {
    right: 0.25rem;
  }

  .book-nav__arrow {
    border-top-width: 3px;
    border-bottom-width: 3px;
  }

  .book-nav--prev .book-nav__arrow { border-right-width: 4px; }
  .book-nav--next .book-nav__arrow { border-left-width: 4px; }

  .stepper {
    padding: 0.5rem 0.75rem;
  }

  .stepper__text {
    font-size: 0.75rem;
  }

  .stepper__progress {
    max-width: 100px;
  }

  .footer {
    padding: 0.875rem 16px;
  }

  .footer__inner {
    flex-direction: column;
    align-items: center;
  }

  .footer__left {
    display: contents;
  }

  .footer__logo-wrap {
    order: 1;
    width: 100%;
    max-width: 100px;
    margin: 0 auto;
  }

  .footer__logo-wrap img {
    max-height: 72px;
    object-position: center;
  }

  .footer__right {
    order: 2;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .footer__right::before {
    display: none;
  }

  .footer__text {
    order: 3;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0 4px;
    box-sizing: border-box;
  }

  .footer__title {
    font-size: 0.9375rem;
  }

  .footer__desc {
    font-size: 0.75rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .footer__btn {
    min-width: 120px;
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
  }

  .top-actions {
    top: 0.75rem;
    right: 0.75rem;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .menu-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
}

/* Çok küçük ekranlar */
@media (max-width: 400px) {
  .header {
    padding: 0.5rem 0.75rem;
  }

  .header__title {
    font-size: 0.9375rem;
  }

  .header__logo img {
    height: 32px;
  }

  .book__page--single {
    width: calc(100vw - 1rem);
  }

  .footer__logo-wrap {
    max-width: 100px;
  }

  .footer__logo-wrap img {
    max-height: 64px;
  }
}
