:root {
  --transition-speed: 0.3s;
  --click-link: #1a0dab;
  --text: #111111;
  --caption: #8d8d8d;
  --border-color: rgba(20, 35, 55, 0.14);
  --bg: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.7;
}

a {
  color: var(--text);
  text-decoration: none;
}

button {
  font: inherit;
}

.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;
}

/* Header */

.base-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;

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

  padding: 1rem 2rem;

  background: linear-gradient(
    to bottom,
    rgba(255,255,255,.18),
    rgba(255,255,255,.05),
    transparent
  );

  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);

  box-shadow: 0 10px 30px rgba(0,0,0,.08);

  transition:
    opacity .35s ease,
    backdrop-filter .35s ease,
    background .35s ease;

  animation: headerFloat 8s ease-in-out infinite;
}

.base-header.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes headerFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

.logo {
  position: relative;
  color: white;
  font-size: 1.7rem;
  font-weight: 700;
}

.logo::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -4px;
  width: 28px;
  height: 2px;
  background: rgba(255,255,255,.65);
  transition: width .3s;
}

.logo:hover::after {
  width: 100%;
}

.base-nav,
.base-footer nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.base-nav a,
.base-nav button {
  position: relative;
  border: 0;
  padding: .4rem .2rem;
  background: transparent;
  color: white;
  font-size: 1.125rem;
  font-weight: 500;
  cursor: pointer;
}

.base-nav a::after,
.base-nav button::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: white;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .25s;
}

.base-nav a:hover::after,
.base-nav button:hover::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
}

/* Main */

.main {
  position: relative;
  background: #fff;
}

.main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 900px;
  z-index: 0;

  background:
    url("./assets/images/where-the-earth-meets-the-sky-article.jpg") center/cover no-repeat;

  opacity: .24;

  mask-image: linear-gradient(to bottom, black 30%, transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent 75%);
}

.main > * {
  position: relative;
  z-index: 1;
}

.content-width {
  width: 100%;
  padding-inline: 10%;
}

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;

  padding-top: 8rem;
  padding-bottom: 2.5rem;
}

.hero-background {
  position: absolute;
  inset: 70px 0 0;
  z-index: -1;

  background-size: cover;
  background-position: center;

  opacity: .18;

  transition:
    background-image 1s ease,
    opacity .8s ease;

  mask-image: linear-gradient(to bottom, black 30%, transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent 80%);
}

.section-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

/* Featured */

.featured-reading {
  padding: 0 10%;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: stretch;
  width: 100%;
}

.featured-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;

  border: 1px solid rgba(255,255,255,.16);
  border-radius: .75rem;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
}

.featured-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.featured-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(255,255,255,.06);
}

.featured-source,
.reading-source {
  margin: 0;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .7;
}

.featured-title,
.reading-title {
  margin: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.featured-title {
  font-size: 1.2rem;
}

.featured-summary {
  display: -webkit-box;
  flex: 1;
  overflow: hidden;
  margin: 0;
  line-height: 1.6;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
}

.featured-link,
.reading-link {
  width: fit-content;
  margin-top: auto;
  color: var(--click-link);
  font-style: italic;
}

/* RSS */

.rss-card {
  margin: 2.5rem 10% 0;
  padding: 1.6rem 1.8rem;
  border: 1px solid rgba(20,35,55,.14);
  border-radius: .75rem;
  background: rgba(255,255,255,.76);
}

.rss-title {
  margin: 0 0 .4rem;
  font-size: 1.25rem;
}

.rss-description {
  margin: 0;
}

.rss-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: .4rem;
  padding: .35rem .7rem;
  border-radius: .4rem;
  background: #3fa1d4;
  color: white;
  font-size: .9rem;
  font-weight: 700;
}

/* Rabbit hole */

.page-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 10% 6rem;
}

.latest-reading {
  width: 100%;
  max-width: 1200px;
}

.section-title {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 300;
  line-height: 1.15;
}

.section-description {
  margin: .5rem 0 2.5rem;
  color: #555;
}

.latest-grid {
  display: grid;
  gap: 2rem;
  width: 100%;
}

.reading-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.reading-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
}

.reading-content {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.reading-meta,
.reading-summary {
  margin: 0;
}

.reading-meta {
  font-size: .9rem;
  color: #666;
}

.reading-summary {
  line-height: 1.6;
}

/* Footer */

.base-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 1.5rem 1rem max(1.5rem, env(safe-area-inset-bottom));
}

.base-footer a,
.base-footer button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--caption);
  font-size: .9rem;
  cursor: pointer;
}

.base-footer p {
  margin: 0;
  color: var(--caption);
  font-size: .9rem;
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;

  width: 42px;
  height: 42px;

  border: 0;
  border-radius: 5px;

  background: rgba(255,255,255,.9);
  color: #777;
  box-shadow: 0 4px 18px rgba(0,0,0,.10);

  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);

  transition: opacity .25s, transform .25s;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Mobile */

@media (max-width: 1100px) and (min-width: 769px) {
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    font-size: 17px;
  }

  .base-header {
    padding: .75rem 1.25rem;
    background: linear-gradient(
      to bottom,
      rgba(71,172,229,.95) 0%,
      rgba(66,168,223,.92) 55%,
      rgba(58,159,212,.90) 100%
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,.12);
  }

  .nav-toggle {
    display: block;
    position: relative;
    z-index: 1003;
    border: 0;
    padding: .25rem .5rem;
    background: none;
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
  }

  .base-header .base-nav {
    position: fixed;
    inset: 0;
    z-index: 1001;

    width: 100%;
    height: 100vh;
    height: 100dvh;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;

    background: linear-gradient(
      to bottom,
      rgba(71,172,229,.98) 0%,
      rgba(66,168,223,.95) 55%,
      rgba(58,159,212,.93) 100%
    );

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .4s ease, visibility .4s ease;
  }

  .base-header .base-nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .base-header .base-nav a,
  .base-header .base-nav button {
    color: white;
    font-size: 2.2rem;
    opacity: 1;
  }

  body.menu-open {
    overflow: hidden;
  }

  .hero {
    min-height: auto;
    padding-top: 7rem;
    padding-bottom: 3rem;
  }

  .content-width,
  .featured-reading,
  .page-container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-card {
    background: rgba(255,255,255,.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.20);
    box-shadow: 0 8px 32px rgba(0,0,0,.10);
  }

  .rss-card {
    margin: 2rem 0 0;
    padding: 1.5rem;
  }

  .rss-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .rss-button {
    width: 100%;
    margin: 0 0 .7rem;
  }

  .reading-card {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-bottom: 1.5rem;
  }

  .reading-content {
    padding: 0;
  }

  .section-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }
}
