/* =========================================
   ELLIPSE MAGAZINES
   SHARED EDITION SYSTEM
========================================= */

/* =========================================
   THEME
========================================= */

:root {
  --background: #f5f3ee;
  --surface: #ffffff;

  --text: #171717;
  --muted: #77736c;

  --line: #d9d5cd;

  --hover: #ebe8e1;

  --page-width: 1100px;
  --reading-width: 690px;
}

body.dark-mode {
  --background: #111111;
  --surface: #181818;

  --text: #eeeeee;
  --muted: #999999;

  --line: #343434;

  --hover: #222222;
}

/* =========================================
   RESET
========================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;

  background: var(--background);
  color: var(--text);

  font-family: Georgia, "Times New Roman", serif;

  transition:
    background-color 0.35s ease,
    color 0.35s ease;
}

img {
  max-width: 100%;
}

button,
select {
  font: inherit;
}

/* =========================================
   ACCESSIBILITY
========================================= */

.sr-only {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;

  clip: rect(0, 0, 0, 0);

  white-space: nowrap;

  border: 0;
}

/* =========================================
   NAVBAR
========================================= */

.edition-header {
  width: 100%;

  padding: 25px 5vw;

  display: flex;

  align-items: center;
  justify-content: space-between;

  border-bottom: 1px solid var(--line);

  position: sticky;
  top: 0;

  z-index: 100;

  background: var(--background);

  transition:
    background-color 0.35s ease,
    border-color 0.35s ease;
}

/* =========================================
   ELLIPSE LOGO
========================================= */

.brand {
  display: inline-flex;

  align-items: center;

  text-decoration: none;
}

.brand-ellipse {
  position: relative;

  width: 178px;
  height: 42px;

  display: flex;

  align-items: center;
  justify-content: center;

  transform: rotate(-4deg);
}

.brand-ellipse::before {
  content: "";

  position: absolute;

  inset: 0;

  border: 1px solid var(--text);

  border-radius: 50%;
}

.brand-ellipse::after {
  content: "";

  position: absolute;

  width: 48px;
  height: 38px;

  left: -2px;
  top: 2px;

  border-left: 5px solid var(--text);

  border-radius: 50%;

  transform: rotate(-2deg);
}

.brand-title {
  position: relative;

  z-index: 2;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  font-weight: 500;

  letter-spacing: 0.16em;

  color: var(--text);

  transform: rotate(4deg);
}

.brand-ellipse span::after {
  content: "";

  position: absolute;

  width: 32px;
  height: 26px;

  right: -7px;
  top: 8px;

  border-right: 1px solid color-mix(in srgb, var(--text) 35%, transparent);

  border-radius: 50%;

  box-shadow:
    4px 0 6px color-mix(in srgb, var(--text) 14%, transparent),
    8px 0 15px color-mix(in srgb, var(--text) 7%, transparent);
}

/* =========================================
   HEADER CONTROLS
========================================= */

.edition-header-right {
  display: flex;

  align-items: center;

  gap: 22px;
}

.edition-number {
  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  letter-spacing: 0.16em;

  color: var(--muted);
}

/* =========================================
   CHAPTER SELECT
========================================= */

.chapter-select {
  appearance: none;

  border: 1px solid var(--line);

  background: var(--background);

  color: var(--text);

  padding: 9px 30px 9px 12px;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 11px;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}
.chapter-dropdown {
  position: relative;
}

.chapter-dropdown-button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--background);
  color: var(--text);
  padding: 9px 30px 9px 12px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  cursor: pointer;
  min-width: 360px;
  text-align: left;
}

.chapter-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  max-height: 190px;
  overflow-y: auto;
  background: var(--background);
  border: 1px solid var(--line);
  z-index: 100;
  display: none;
}

.chapter-dropdown.open .chapter-dropdown-menu {
  display: block;
}

.chapter-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.chapter-dropdown-menu button:hover {
  background: var(--hover);
}
.chapter-select:hover {
  background: var(--hover);
}

/* =========================================
   LIGHT / DARK TOGGLE
========================================= */

.theme-toggle {
  border: 1px solid var(--line);
  padding: 5px 7px;

  display: flex;
  align-items: center;
  gap: 6px;

  border-radius: 30px;

  background: var(--background);
  color: var(--muted);

  cursor: pointer;

  transition:
    background-color 0.25s ease,
    border-color 0.25s ease;
}

.theme-icon {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1;
}

.theme-switch-track {
  width: 30px;
  height: 16px;

  padding: 2px;

  display: flex;
  align-items: center;

  border-radius: 20px;

  background: var(--line);

  transition: background-color 0.25s ease;
}

.theme-switch-knob {
  width: 12px;
  height: 12px;

  border-radius: 50%;

  background: var(--text);

  transform: translateX(0);

  transition:
    transform 0.25s ease,
    background-color 0.25s ease;
}

body.dark-mode .theme-switch-knob {
  transform: translateX(14px);
}

.theme-toggle:hover {
  color: var(--text);
}

/* =========================================
   MAGAZINE CONTAINER
========================================= */

.magazine {
  width: min(var(--page-width), calc(100% - 40px));

  margin: 0 auto;
}

/* =========================================
   MAGAZINE PAGES
========================================= */

/* =========================================
   MAGAZINE PAGES
========================================= */

.magazine-page {
  min-height: calc(100vh - 92px);

  padding: 100px 0 110px;

  border-bottom: 1px solid var(--line);

  scroll-margin-top: 100px;
}

/* Hide inactive pages */

.magazine-page:not(.active-page) {
  display: none;
}

/* Active page */

.magazine-page.active-page {
  display: block;
}

/* =========================================
   CONTENTS PAGE
========================================= */

.contents-inner {
  min-height: calc(100vh - 210px);

  display: flex;

  flex-direction: column;
}

.contents-top {
  display: flex;

  justify-content: space-between;

  align-items: center;

  padding-bottom: 20px;

  border-bottom: 1px solid var(--line);
}

.page-label,
.page-edition {
  margin: 0;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  letter-spacing: 0.16em;

  color: var(--muted);
}

.contents-title-area {
  padding: 80px 0 70px;
}

.contents-title-area h1 {
  margin: 0;

  font-size: clamp(65px, 10vw, 125px);

  font-weight: 400;

  line-height: 0.9;

  letter-spacing: -0.055em;
}

/* =========================================
   CONTENTS LIST
========================================= */

.contents-list {
  border-top: 1px solid var(--line);
}

.contents-item {
  display: grid;

  grid-template-columns:
    70px
    1fr
    40px;

  align-items: center;

  gap: 20px;

  min-height: 80px;

  padding: 16px 10px 16px 0;

  border-bottom: 1px solid var(--line);

  color: var(--text);

  text-decoration: none;

  transition:
    padding 0.25s ease,
    background-color 0.25s ease;
}

.contents-item:hover {
  padding-left: 18px;

  padding-right: 18px;

  background: var(--hover);
}

.contents-number {
  font-family: Arial, Helvetica, sans-serif;

  font-size: 11px;

  color: var(--muted);
}

.contents-name {
  font-size: clamp(19px, 2.4vw, 27px);

  line-height: 1.3;
}

.contents-arrow {
  font-family: Arial, Helvetica, sans-serif;

  font-size: 17px;

  text-align: right;

  transition: transform 0.25s ease;
}

.contents-item:hover .contents-arrow {
  transform: translateX(5px);
}

/* =========================================
   CONTENTS NAVIGATION
========================================= */

.contents-navigation {
  margin-top: auto;

  padding-top: 80px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 20px;
}

/* =========================================
   CHAPTER BUTTONS
========================================= */

.chapter-button {
  display: inline-flex;

  align-items: center;

  justify-content: space-between;

  gap: 25px;

  min-width: 190px;

  padding: 15px 18px;

  border: 1px solid var(--line);

  color: var(--text);

  text-decoration: none;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  letter-spacing: 0.12em;

  text-transform: uppercase;

  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

.chapter-button:hover {
  background: var(--hover);

  transform: translateY(-2px);
}

.chapter-button-direction {
  font-size: 16px;
}

.chapter-next {
  margin-left: auto;
}

/* =========================================
   TOP BUTTON
========================================= */

.top-button {
  display: inline-flex;

  align-items: center;

  gap: 8px;

  color: var(--muted);

  text-decoration: none;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  letter-spacing: 0.12em;

  text-transform: uppercase;

  transition: color 0.2s ease;
}

.top-button:hover {
  color: var(--text);
}
.read-again-button {
  display: inline-flex;

  align-items: center;

  gap: 8px;

  color: var(--muted);

  text-decoration: none;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  letter-spacing: 0.12em;

  text-transform: uppercase;

  transition: color 0.2s ease;
}

.read-again-button:hover {
  color: var(--text);
}
/* =========================================
   ARTICLE HEADER
========================================= */

.article {
  max-width: 900px;

  margin-left: auto;
  margin-right: auto;
}

.article-header {
  max-width: 850px;
}

.article-kicker {
  margin: 0 0 25px;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  letter-spacing: 0.18em;

  color: var(--muted);
}

.article-title {
  margin: 0;

  font-size: clamp(55px, 8vw, 105px);

  font-weight: 400;

  line-height: 0.95;

  letter-spacing: -0.05em;
}

.article-subtitle {
  max-width: 700px;

  margin: 35px 0 70px;

  font-size: clamp(20px, 2.5vw, 28px);

  line-height: 1.45;

  color: var(--muted);
}

/* =========================================
   HERO IMAGE
========================================= */

.article-hero {
  margin: 0 0 70px;
}

.article-hero img {
  display: block;

  width: 100%;

  height: auto;
}

.article-hero figcaption,
.article-image figcaption {
  margin-top: 12px;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 10px;

  line-height: 1.5;

  color: var(--muted);
}
.article-hero figcaption a,
.article-image figcaption a {
  color: #2563eb;

  text-decoration: none;

  margin-left: 6px;
}

.article-hero figcaption a:hover,
.article-image figcaption a:hover {
  text-decoration: underline;
}
/* =========================================
   ARTICLE BODY
========================================= */

.article-body {
  max-width: var(--reading-width);

  margin: 0 auto;
}

.article-body p {
  margin: 0 0 30px;

  font-size: 19px;

  line-height: 1.85;
}

/* =========================================
   SECTION HEADING
   H2
========================================= */

.article-body h2 {
  margin: 90px 0 28px;

  font-size: clamp(32px, 4vw, 46px);

  font-weight: 400;

  line-height: 1.12;

  letter-spacing: -0.025em;
}

/* =========================================
   SUBHEADING
   H3
========================================= */

.article-body h3 {
  margin: 60px 0 20px;

  font-size: clamp(25px, 3vw, 34px);

  font-weight: 500;

  line-height: 1.2;
}

/* =========================================
   SUB-SUBHEADING
   H4
========================================= */

.article-body h4 {
  margin: 45px 0 16px;

  font-family: Arial, Helvetica, sans-serif;

  font-size: clamp(16px, 2vw, 19px);

  font-weight: 600;

  line-height: 1.35;

  letter-spacing: 0.01em;
}

/* =========================================
   QUOTES
========================================= */

.article-body blockquote {
  margin: 70px 0;

  padding-left: 30px;

  border-left: 2px solid var(--text);

  font-size: clamp(25px, 3vw, 34px);

  line-height: 1.35;

  font-style: italic;
}

/* =========================================
   ARTICLE IMAGES
========================================= */

.article-image {
  margin: 65px 0;
}

.article-image img {
  display: block;

  width: 100%;

  height: auto;
}

/* =========================================
   CHAPTER NAVIGATION
========================================= */

.chapter-navigation {
  max-width: 900px;

  margin: 110px auto 0;

  padding-top: 25px;

  border-top: 1px solid var(--line);

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 25px;
}

.article-bottom {
  max-width: 900px;

  margin: 35px auto 0;

  display: flex;

  justify-content: center;

  gap: 30px;
}

/* =========================================
   FOOTER
========================================= */

.edition-footer {
  width: min(var(--page-width), calc(100% - 40px));

  margin: auto;

  padding: 30px 0;

  display: flex;

  justify-content: space-between;

  font-family: Arial, Helvetica, sans-serif;

  font-size: 9px;

  letter-spacing: 0.15em;

  color: var(--muted);
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {
  .edition-header {
    padding: 18px 16px;

    gap: 12px;
  }

  .brand-ellipse {
    width: 145px;
    height: 36px;
  }

  .brand-title {
    font-size: 8px;
  }

  .edition-header-right {
    gap: 10px;
  }

  .edition-number {
    display: none;
  }

  .chapter-select {
    max-width: 115px;

    padding: 8px 8px;
  }

  .theme-toggle {
    font-size: 9px;

    white-space: nowrap;
  }

  .magazine {
    width: calc(100% - 28px);
  }

  .magazine-page {
    padding: 70px 0 80px;
  }

  .contents-title-area {
    padding: 65px 0 50px;
  }

  .contents-title-area h1 {
    font-size: 68px;
  }

  .contents-item {
    grid-template-columns:
      42px
      1fr
      25px;

    gap: 10px;

    min-height: 70px;
  }

  .contents-name {
    font-size: 19px;
  }

  .contents-navigation {
    padding-top: 60px;

    align-items: flex-start;

    flex-direction: column;
  }

  .chapter-next {
    margin-left: 0;
  }

  .article-title {
    font-size: 57px;
  }

  .article-subtitle {
    margin-bottom: 45px;

    font-size: 20px;
  }

  .article-body p {
    font-size: 18px;

    line-height: 1.8;
  }

  .article-body h2 {
    margin-top: 70px;

    font-size: 34px;
  }

  .article-body h3 {
    margin-top: 50px;

    font-size: 27px;
  }

  .article-body h4 {
    margin-top: 38px;

    font-size: 17px;
  }

  .article-body blockquote {
    margin: 55px 0;

    padding-left: 20px;

    font-size: 25px;
  }

  .chapter-navigation {
    margin-top: 75px;

    align-items: stretch;

    flex-direction: column;
  }

  .chapter-button {
    width: 100%;
  }

  .article-bottom {
    margin-top: 30px;
  }

  .edition-footer {
    width: calc(100% - 28px);
  }
}
/* RESPONSIVE CHAPTER DROPDOWN WIDTH */

@media (max-width: 550px) {
  .chapter-dropdown-button {
    min-width: 120px;
  }
}

@media (min-width: 551px) and (max-width: 1024px) {
  .chapter-dropdown-button {
    min-width: 150px;
  }
}
