*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--accent-hover);
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 40;
  background: #1e293b;
  color: #fff;
  padding: 8px 12px;
}

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-content {
  flex-grow: 1;
  padding-top: 64px;
}

.ast-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.ast-article {
  background: var(--card);
  padding: 3em;
  margin: 0 0 4em;
}

.ast-no-title {
  margin: 0;
  padding: 0;
  min-height: 0;
  height: 0;
  overflow: hidden;
}

.site-header {
  display: none;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 80px;
  padding: 8px 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.logo img {
  display: block;
  width: 100%;
  max-width: 737px;
  height: auto;
}

.site-title {
  display: block;
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 4px;
}

.site-title a {
  color: var(--heading);
}

.site-title a:hover {
  color: var(--accent-hover);
}

.nav-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.mobile-panel {
  background: #fff;
}

.mobile-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-panel a {
  display: block;
  padding: 14px 20px;
  color: var(--text);
}

.mobile-panel a:hover,
.mobile-panel a[aria-current="page"] {
  color: var(--accent-hover);
  background: var(--bg);
}

.entry-header {
  text-align: left;
  margin-bottom: 10px;
}

.entry-title {
  margin: 0 0 0.5em;
  color: var(--heading);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3em;
}

.entry-content a {
  text-decoration: underline;
}

.entry-content p {
  margin: 0 0 1.25em;
}

.entry-content blockquote {
  margin: 1.5em;
  padding: 0 0 0 1em;
  border-left: 5px solid rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.site-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  min-height: 80px;
  padding: 0;
}

.footer-inner {
  max-width: 1200px;
  min-height: 80px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.footer-inner p {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
}

.scroll-top {
  position: fixed;
  right: 30px;
  bottom: 30px;
  z-index: 99;
  width: 2.1em;
  height: 2.1em;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.scroll-top svg {
  width: 1.6em;
  height: auto;
  fill: currentColor;
  transform: translate(0, -10%) rotate(180deg);
}

.flipbook {
  position: relative;
  height: 680px;
  background: var(--flip-bg);
}

.flip-stage {
  position: absolute;
  inset: 0 0 0 0;
  padding: 20px 20px 62px;
}

.flip-sheet {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: transparent;
  transform-origin: center center;
}

.flip-scene {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 2200px;
  perspective-origin: 50% 45%;
  transform-style: preserve-3d;
}

.flip-rest,
.flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flip-rest {
  z-index: 0;
  pointer-events: none;
}

.flip-leaf {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  transform-origin: left center;
  transform-style: preserve-3d;
  cursor: pointer;
}

.flip-face {
  background: transparent;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.flip-face .flip-page {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.flip-back {
  transform: rotateY(180deg);
}

.flip-leaf::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 22%, transparent 70%, rgba(0, 0, 0, 0.32));
  opacity: 0;
}

.flipbook.is-flipping .flip-leaf::after {
  opacity: 1;
  transition: opacity 180ms linear;
}

.flipbook.is-flipping {
  cursor: progress;
}

.flip-page {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
}

.flip-page-b {
  border-left: 1px solid #ddd;
}

.flipbook.is-double .flip-scene {
  display: none;
}

.flipbook.is-double .flip-page-b {
  display: block;
}

.flipbook.is-double .flip-sheet {
  gap: 0;
}

.flipbook.is-double .flip-page {
  width: 50%;
}

.flip-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 28px;
  height: 56px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #fff;
  font-size: 42px;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.flip-prev {
  left: 8px;
}

.flip-next {
  right: 8px;
}

.flip-ui {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
}

.flip-page-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
}

.flip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
}

.flip-btn:hover,
.flip-more-item:hover {
  background: #f3f4f6;
  color: #333;
}

.flip-btn.is-disabled,
.flip-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.flip-more-wrap {
  position: relative;
}

.flip-more {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 220px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 6px 0;
}

.flip-more-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
  text-decoration: none;
}

.flip-thumbs {
  position: absolute;
  inset: 0 0 52px 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 16px;
  overflow: auto;
  background: rgba(40, 40, 40, 0.92);
}

.flip-thumb {
  padding: 0;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
}

.flip-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #fff;
}

.flipbook.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 80;
  height: 100% !important;
  width: 100%;
  overflow: hidden;
}

@media (max-width: 921px) {
  .site-content {
    padding-top: 0;
  }

  .site-header {
    display: block;
  }

  .flipbook {
    height: 460px;
  }
}

@media (max-width: 544px) {
  .ast-container {
    padding-left: 0.54em;
    padding-right: 0.54em;
  }

  .ast-article {
    padding: 1.5em 1em;
    margin-bottom: 2em;
  }

  .footer-inner {
    padding: 20px 8px;
  }

  h1,
  .entry-title {
    font-size: 30px;
  }
}

@media (min-width: 922px) {
  .ast-container {
    max-width: 1240px;
  }
}
