/*
Theme Name: Iain Ballantyne
Theme URI: https://example.com/
Author: 3Sixty Creative
Description: Responsive WordPress theme for Iain Ballantyne, with a dynamic books carousel and latest articles feed.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: iain-ballantyne
*/

:root {
  --black: #050505;
  --charcoal: #191919;
  --paper: #eeeae2;
  --cream: #f6f3ec;
  --gold: #b79853;
  --red: #ef3f3d;
  --text: #eaece3;
  --ink: #161616;
  --muted: #cbc5b8;
  --max: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 19px;
  line-height: 1.28;
}

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

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

.wrap {
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #020202;
  border-bottom: 1px solid rgba(183, 152, 83, .18);
}

.header-inner {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.site-nav,
.button,
.small-button,
.eyebrow,
h2 {
  font-family: Montserrat, Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand {
  font-weight: 600;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: clamp(18px, 2.5vw, 36px);
  align-items: center;
  color: var(--gold);
  font-size: .88rem;
  font-weight: 500;
}

.site-nav ul {
  display: flex;
  gap: inherit;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a:first-child,
.site-nav li:first-child a {
  color: var(--text);
}

.nav-toggle {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.menu-button {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.menu-button span {
  width: 26px;
  height: 2px;
  background: var(--gold);
}

.dark-texture {
  background:
    radial-gradient(circle at 16px 18px, rgba(255, 255, 255, .04) 1px, transparent 1px),
    radial-gradient(circle at 92px 64px, rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, .035), transparent 32%),
    #20201f;
  background-size: 128px 128px, 140px 140px, cover, cover;
}

.light-texture {
  background:
    radial-gradient(circle at 22px 24px, rgba(0, 0, 0, .045) 1px, transparent 1px),
    radial-gradient(circle at 118px 82px, rgba(0, 0, 0, .035) 1px, transparent 1px),
    linear-gradient(135deg, rgba(0, 0, 0, .04), transparent 34%),
    #eeeae2;
  background-size: 142px 142px, 170px 170px, cover, cover;
}

.hero {
  position: relative;
  padding: clamp(44px, 6vw, 78px) 0 64px;
  background:
    linear-gradient(90deg, rgba(7, 7, 7, .78) 0%, rgba(7, 7, 7, .6) 48%, rgba(7, 7, 7, .24) 100%),
    linear-gradient(180deg, rgba(7, 7, 7, .12), rgba(7, 7, 7, .48)),
    url("assets/images/hero-back.jpg") center / cover no-repeat;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(230px, 315px) minmax(0, 580px);
  gap: clamp(36px, 6vw, 70px);
  align-items: center;
  justify-content: start;
}

.latest-cover {
  width: min(100%, 315px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, .28);
}

.hero-copy {
  max-width: 620px;
}

.eyebrow {
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--gold);
  font-size: clamp(1.25rem, 2.8vw, 2rem);
}

h1 {
  margin: 0 0 12px;
  font-family: Montserrat, Arial, sans-serif;
  font-size: clamp(3rem, 6vw, 5rem);
  line-height: .95;
  letter-spacing: 0;
}

.lead {
  margin-top: 0;
}

.hero p,
.about p,
.site-footer p {
  max-width: 650px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 40px;
  margin-top: 30px;
}

.button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 4px;
  padding: 0 38px;
  color: var(--text);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1;
  text-align: center;
  transition: opacity .18s ease, transform .18s ease, box-shadow .18s ease;
  will-change: transform;
}

.button:hover,
.button:focus-visible,
.small-button:hover,
.small-button:focus-visible {
  opacity: .88;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .22);
}

.gold {
  background: var(--gold);
}

.red {
  background: var(--red);
}

.about {
  overflow: hidden;
  background: var(--charcoal);
  padding: 56px 0 0;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 650px) minmax(280px, 430px);
  gap: clamp(34px, 7vw, 95px);
  align-items: end;
}

h2 {
  font-weight: 600;
  margin: 0 0 22px;
  color: var(--gold);
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.about-copy {
  align-self: start;
  padding-bottom: 48px;
}

.author-photo {
  width: min(100%, 430px);
  justify-self: end;
}

.books {
  padding: 42px 0 70px;
}

.books h2,
.articles h2 {
  text-align: center;
}

.carousel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: clamp(18px, 3vw, 42px);
  align-items: center;
}

.book-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 1fr);
  gap: clamp(18px, 3vw, 42px);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
}

.book-rail::-webkit-scrollbar {
  display: none;
}

.rail-arrow {
  border: 0;
  background: transparent;
  color: rgba(234, 236, 227, .75);
  font-size: 4rem;
  line-height: 1;
  cursor: pointer;
}

.book-card {
  display: grid;
  justify-items: center;
  gap: 28px;
  scroll-snap-align: start;
}

.book-card img {
  width: 190px;
  aspect-ratio: 190 / 280;
  object-fit: cover;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .28);
}

.small-button {
  min-height: 32px;
  padding-inline: 22px;
  background: var(--gold);
  font-size: .82rem;
}

.articles {
  color: var(--ink);
  padding: 62px 0 78px;
}

.articles h2 {
  color: var(--ink);
  margin-bottom: 48px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 42px);
}

.article-card {
  display: block;
  background: #fff;
  min-width: 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .07);
}

.article-card img {
  width: 100%;
  aspect-ratio: 270 / 170;
  object-fit: cover;
}

.article-card h3 {
  min-height: 135px;
  margin: 0;
  padding: 22px 20px 28px;
  font-family: Montserrat, Arial, sans-serif;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.archive-button {
  display: flex;
  width: fit-content;
  margin: 48px auto 0;
}

.single-book-page {
  background: var(--charcoal);
  color: var(--text);
}

.book-top {
  padding: 0;
}

.book-banner {
  width: 100%;
  height: clamp(170px, 20vw, 260px);
  object-fit: cover;
}

.book-detail {
  padding: clamp(72px, 9vw, 138px) 0 clamp(96px, 12vw, 170px);
}

.book-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 700px);
  gap: clamp(46px, 7vw, 84px);
  align-items: start;
}

.book-sidebar {
  display: grid;
  gap: 52px;
}

.book-single-cover {
  width: 100%;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .34);
}

.book-action-panel {
  display: grid;
  gap: 22px;
  padding: 28px;
}

.book-action-panel p {
  margin: 0 0 18px;
  font-family: Montserrat, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
}

.book-action-panel .button {
  width: 100%;
  justify-content: flex-start;
  padding-inline: 18px;
}

.book-content h1,
.article-main h1 {
  margin: 0 0 28px;
  font-family: Montserrat, Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}

.book-content h1 {
  font-size: clamp(2.25rem, 3.75vw, 3.5rem);
  line-height: .98;
  overflow-wrap: anywhere;
}

.book-subtitle {
  margin: 0 0 30px;
  color: var(--gold);
  font-family: Montserrat, Arial, sans-serif;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  font-weight: 600;
  line-height: 1.18;
}

.entry-content {
  font-size: 1.18rem;
  line-height: 1.28;
}

.entry-content > *:first-child {
  margin-top: 0;
}

.entry-content p {
  margin: 0 0 28px;
}

.entry-content img,
.entry-content figure {
  max-width: 100%;
}

.entry-content figure {
  margin: 34px 0;
}

.entry-content img,
.book-inline-image {
  height: auto;
}

.book-inline-image {
  width: 100%;
  margin-top: 12px;
}

.single-article-page {
  min-height: 100vh;
  color: var(--ink);
  padding: clamp(54px, 7vw, 82px) 0 clamp(96px, 12vw, 150px);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(260px, 350px);
  gap: clamp(44px, 7vw, 82px);
  align-items: start;
}

.article-main h1 {
  color: #2d2d2d;
  font-size: clamp(2.25rem, 4.2vw, 3.7rem);
  line-height: 1;
}

.article-main .entry-content {
  font-size: 1.18rem;
  line-height: 1.32;
}

.article-main .entry-content img {
  width: 100%;
  margin: 24px 0;
}

.article-main .entry-content .wp-caption,
.article-main .entry-content figcaption,
.article-main .entry-content blockquote {
  background: rgba(255, 255, 255, .72);
  padding: 16px 18px;
}

.recent-posts-panel {
  padding: 28px 30px 44px;
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 18px 36px rgba(0, 0, 0, .04);
}

.recent-posts-panel h2 {
  margin-bottom: 34px;
  font-size: 1.45rem;
  text-align: left;
}

.recent-posts-panel ul {
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-posts-panel a {
  font-family: Montserrat, Arial, sans-serif;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.24;
}

.site-footer {
  border-top: 2px solid rgba(183, 152, 83, .78);
  padding: 64px 0 70px;
  background: #030303;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.35fr) minmax(220px, 1fr);
  gap: clamp(30px, 5vw, 70px);
  align-items: end;
}

.site-footer h2 {
  font-size: 1.35rem;
}

address {
  font-style: normal;
}

.site-footer a {
  color: var(--gold);
}

.footer-social {
  display: grid;
  justify-items: end;
  gap: 42px;
}

.social-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  color: #050505;
  background: #fff;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.social-links a:last-child {
  background: transparent;
  color: var(--text);
  font-size: 3rem;
}

@media (max-width: 980px) {
  .header-inner {
    min-height: 76px;
  }

  .menu-button {
    display: flex;
  }

  .site-nav {
    position: absolute;
    inset: 76px 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 10px 24px 22px;
    background: #020202;
    border-top: 1px solid rgba(183, 152, 83, .18);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform .22s ease, opacity .22s ease;
  }

  .site-nav a {
    padding: 15px 0;
  }

  .site-nav ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  .nav-toggle:checked ~ .site-nav {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .hero-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .latest-cover,
  .author-photo {
    justify-self: center;
  }

  .hero-copy {
    justify-self: center;
  }

  .about-copy {
    padding-bottom: 0;
  }

  .book-rail {
    grid-auto-columns: minmax(190px, 30%);
  }

  .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .book-detail-grid,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .book-sidebar {
    max-width: 360px;
  }

  .recent-posts-panel {
    max-width: 520px;
  }

  .footer-social {
    grid-column: 1 / -1;
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(100% - 32px, var(--max));
  }

  body {
    font-size: 18px;
  }

  .brand {
    font-size: 1.34rem;
    white-space: normal;
  }

  .hero,
  .books,
  .articles,
  .site-footer {
    padding-block: 42px;
  }

  .hero-grid {
    gap: 30px;
  }

  .latest-cover {
    width: min(74vw, 270px);
  }

  h1 {
    font-size: clamp(2.6rem, 15vw, 4rem);
  }

  .button-row {
    gap: 14px;
  }

  .button,
  .small-button {
    width: 100%;
  }

  .about {
    padding-top: 42px;
  }

  .author-photo {
    width: min(100%, 360px);
  }

  .article-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .carousel {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 8px;
  }

  .book-rail {
    grid-auto-columns: minmax(210px, 78%);
  }

  .book-card {
    gap: 16px;
  }

  .book-card img {
    width: min(62vw, 210px);
  }

  .article-card h3 {
    min-height: auto;
  }

  .book-detail,
  .single-article-page {
    padding-block: 42px;
  }

  .book-sidebar {
    max-width: none;
    gap: 28px;
  }

  .book-action-panel {
    padding: 22px;
  }

  .book-content h1,
  .article-main h1 {
    font-size: clamp(2rem, 9vw, 2.65rem);
  }

  .recent-posts-panel {
    padding: 24px;
  }

  .archive-button {
    width: 100%;
  }
}
