/*
 * Essential Apple — main stylesheet
 * Design language ported from Ghost's "Source" theme (as used on avanlifething.com):
 * Inter typeface, 62.5% rem base, tight letter-spacing, pill buttons,
 * large featured post + responsive card grid, hairline borders, dark footer.
 */

/* ---------------------------------------------------------------------------
   Design tokens
--------------------------------------------------------------------------- */
:root {
  --color-white: #fff;
  --color-lighter-gray: rgba(0, 0, 0, .05);
  --color-light-gray: #e6e6e6;
  --color-mid-gray: #ccc;
  --color-dark-gray: #444;
  --color-darker-gray: #15171a;
  --color-black: #000;

  --color-primary-text: var(--color-darker-gray);
  --color-secondary-text: rgba(0, 0, 0, .55);
  --color-border: rgba(0, 0, 0, .08);
  --color-dark-border: rgba(0, 0, 0, .55);

  /* Apple-blue accent — swap freely in the Customizer-friendly variable below */
  --accent-color: #0071e3;
  --background-color: #fff;

  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --font-serif: "EB Garamond", Georgia, Times, serif;
  --font-mono: "JetBrains Mono", Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace;

  --container-width: 1320px;
  --container-gap: clamp(24px, 1.7032rem + 1.9355vw, 48px);
  --grid-gap: 42px;
  --content-width: 760px;
}

/* On dark surfaces (nav/footer with accent) flip the neutrals */
.has-light-text {
  --color-darker-gray: #fff;
  --color-primary-text: #fff;
  --color-secondary-text: hsla(0, 0%, 100%, .64);
  --color-border: hsla(0, 0%, 100%, .15);
  --color-lighter-gray: hsla(0, 0%, 100%, .1);
}

/* ---------------------------------------------------------------------------
   Reset & base
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  font-size: 62.5%;            /* 1rem = 10px */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1.7rem;
  line-height: 1.6;
  color: var(--color-primary-text);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--color-primary-text);
}

::selection { background: var(--accent-color); color: #fff; }

/* ---------------------------------------------------------------------------
   Layout helpers
--------------------------------------------------------------------------- */
.gh-container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding-inline: var(--container-gap);
}

.gh-canvas {
  width: 100%;
  /* --content-width is the *true* text measure; add the side padding on top so
     the gutters don't eat into it (border-box was shrinking the text column). */
  max-width: calc(var(--content-width) + var(--container-gap) * 2);
  margin: 0 auto;
  padding-inline: var(--container-gap);
}

.gh-outer { width: 100%; }

/* ---------------------------------------------------------------------------
   Navigation
--------------------------------------------------------------------------- */
.gh-navigation {
  background-color: var(--background-color);
  color: var(--color-darker-gray);
  font-size: 1.5rem;
  font-weight: 550;
  border-bottom: 1px solid var(--color-border);
}

.gh-navigation-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100px;
}

.gh-navigation-brand .gh-navigation-logo {
  font-family: var(--font-sans);
  font-size: 2.4rem;
  font-weight: 725;
  letter-spacing: -0.015em;
  line-height: 1;
  white-space: nowrap;
}
.gh-navigation-logo img { max-height: 40px; width: auto; }

.gh-navigation-menu { display: flex; align-items: center; }
.gh-navigation-menu ul {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  padding: 0;
}
.gh-navigation-menu a {
  letter-spacing: -0.01em;
  transition: opacity .2s ease;
}
.gh-navigation-menu a:hover { opacity: .65; color: inherit; }

.gh-navigation-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.gh-navigation-actions .gh-signin { font-weight: 550; }

.gh-burger { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.gh-burger span {
  display: block; width: 22px; height: 2px;
  background: currentColor; border-radius: 2px;
}
.gh-burger span + span { margin-top: 5px; }

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */
.gh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  background-color: var(--accent-color);
  color: var(--color-white);
  border: 0;
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.004em;
  line-height: 1;
  padding: .8em 1.4em;
  cursor: pointer;
  transition: opacity .2s ease, transform .05s ease;
}
.gh-button:hover { opacity: .92; color: #fff; }
.gh-button:active { transform: translateY(1px); }

.gh-button--outline {
  background: transparent;
  color: var(--color-primary-text);
  box-shadow: inset 0 0 0 1px var(--color-border);
}
.gh-button--outline:hover { color: var(--color-primary-text); background: var(--color-lighter-gray); opacity: 1; }

/* ---------------------------------------------------------------------------
   Post feed (grid of cards)
--------------------------------------------------------------------------- */
.gh-feed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: var(--grid-gap);
  gap: var(--grid-gap);
  padding: clamp(32px, 4vw, 64px) 0;
}

/* Featured: first card spans full width, image + text side by side, large type */
.gh-feed .gh-card.is-featured { grid-column: 1 / -1; }
.gh-feed .gh-card.is-featured .gh-card-inner {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
}
.gh-feed .gh-card.is-featured .gh-card-image { aspect-ratio: 16 / 10; }

.gh-card { display: flex; flex-direction: column; }
.gh-card-inner { display: flex; flex-direction: column; gap: 18px; height: 100%; }
.gh-card-title a { color: inherit; }
.gh-card-title a:hover { color: var(--accent-color); }

.gh-card-image {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 6px;
  background: var(--color-lighter-gray);
}
/* Absolutely fill the box so the image is removed from flow and can never
   overflow or overlap text — regardless of the width/height attributes that
   WordPress prints on the_post_thumbnail() output. */
.gh-card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transition: transform .4s ease;
}
.gh-card:hover .gh-card-image img { transform: scale(1.03); }

.gh-card-tag {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 4px;
}

.gh-card-title {
  font-size: calc(1.9rem * var(--factor, 1.05));
  font-weight: 725;
  letter-spacing: -0.014em;
  line-height: 1.3;
}
.gh-card.is-featured .gh-card-title {
  font-size: clamp(2.8rem, 1.36vw + 2.25rem, 4rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
}

.gh-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1.45rem;
  line-height: 1.4;
  color: var(--color-secondary-text);
  margin-top: 8px;
}
.gh-card.is-featured .gh-card-excerpt {
  -webkit-line-clamp: 3;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  margin-top: 16px;
  max-width: 90%;
}

.gh-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.004em;
  color: var(--color-secondary-text);
}
.gh-card-meta time::after { content: ""; }

/* ---------------------------------------------------------------------------
   Section heading / dividers
--------------------------------------------------------------------------- */
.gh-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: clamp(32px, 4vw, 56px);
  border-top: 1px solid var(--color-border);
}
.gh-section-title { font-size: 1.5rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.gh-section-more { font-size: 1.4rem; font-weight: 550; color: var(--color-secondary-text); }
.gh-section-more:hover { color: var(--accent-color); }

/* ---------------------------------------------------------------------------
   Single post / page
--------------------------------------------------------------------------- */
.gh-article { padding: clamp(40px, 6vw, 80px) 0; }
.gh-article-header { text-align: center; max-width: 820px; margin: 0 auto clamp(28px, 4vw, 48px); }
.gh-article-tag {
  font-size: 1.4rem; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--accent-color);
}
.gh-article-title {
  font-size: clamp(3.4rem, 2vw + 2.6rem, 5.6rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin-top: 16px;
}
.gh-article-excerpt {
  font-size: clamp(1.9rem, .6vw + 1.7rem, 2.3rem);
  color: var(--color-secondary-text);
  margin-top: 20px;
  letter-spacing: -0.01em;
}
.gh-article-meta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 28px; font-size: 1.4rem; color: var(--color-secondary-text);
}
.gh-article-image {
  margin: clamp(28px, 4vw, 48px) auto clamp(36px, 4vw, 56px);
  max-width: 1120px;          /* matches Ghost Source's article "wide" column width */
  border-radius: 8px;
  overflow: hidden;
}
/* Natural aspect ratio, exactly like Ghost's feature image. */
.gh-article-image img {
  width: 100%;
  height: auto;
}

/* Post tags (bottom of single posts) — small pills with clear spacing */
.gh-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.gh-tags-label {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-secondary-text);
  margin-right: 2px;
}
.gh-tags a {
  font-size: 1.25rem;
  font-weight: 550;
  letter-spacing: -0.004em;
  line-height: 1;
  color: var(--color-secondary-text);
  background: var(--color-lighter-gray);
  padding: 6px 12px;
  border-radius: 100px;
}
.gh-tags a:hover {
  color: var(--accent-color);
  background: var(--color-light-gray);
}

/* Long-form content — body type matches Ghost Source (17px / 1.6) so the line
   length reads the same, not as a narrow strip. */
.gh-content {
  font-size: 1.7rem;
  line-height: 1.6;
  letter-spacing: -0.01em;
}
.gh-content > * + * { margin-top: 1.5em; }
.gh-content h2 { font-size: calc(1.6em * 1.05); letter-spacing: -0.02em; margin-top: 1.6em; }
.gh-content h3 { font-size: calc(1.3em * 1.05); letter-spacing: -0.017em; margin-top: 1.4em; }
.gh-content a { color: var(--accent-color); box-shadow: inset 0 -1px 0 0 rgba(0,113,227,.3); }
.gh-content a:hover { box-shadow: inset 0 -2px 0 0 var(--accent-color); }
.gh-content img { border-radius: 6px; margin-inline: auto; }
.gh-content blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 24px;
  font-style: italic;
  color: var(--color-dark-gray);
}
.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: .4em; }
.gh-content pre {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  background: var(--color-darker-gray);
  color: #fff;
  padding: 20px 24px;
  border-radius: 8px;
  overflow-x: auto;
}
.gh-content code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--color-lighter-gray);
  padding: 2px 6px; border-radius: 4px;
}
.gh-content pre code { background: none; padding: 0; }
.gh-content figcaption { font-size: 1.4rem; color: var(--color-secondary-text); text-align: center; margin-top: 10px; }

/* ---------------------------------------------------------------------------
   Subscribe / CTA block
--------------------------------------------------------------------------- */
.gh-cta {
  text-align: center;
  padding: clamp(48px, 6vw, 88px) var(--container-gap);
  background: var(--color-darker-gray);
  color: #fff;
  border-radius: 12px;
}
.gh-cta h2 { color: #fff; font-size: clamp(2.6rem, 1.5vw + 2.1rem, 3.6rem); }
.gh-cta p { color: hsla(0,0%,100%,.7); margin-top: 12px; font-size: 1.7rem; }
.gh-cta form { display: flex; gap: 10px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.gh-cta input[type="email"] {
  min-width: 280px;
  padding: 12px 18px;
  border-radius: 100px;
  border: 1px solid hsla(0,0%,100%,.2);
  background: hsla(0,0%,100%,.08);
  color: #fff;
  font-size: 1.5rem;
  font-family: inherit;
}
.gh-cta input::placeholder { color: hsla(0,0%,100%,.5); }

/* ---------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
.gh-footer {
  background: var(--color-black);
  color: hsla(0,0%,100%,.7);
  padding: clamp(48px, 6vw, 80px) 0;
  margin-top: clamp(48px, 6vw, 80px);
}
.gh-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.gh-footer a { color: hsla(0,0%,100%,.7); }
.gh-footer a:hover { color: #fff; }
.gh-footer-brand { font-size: 2rem; font-weight: 725; letter-spacing: -0.015em; color: #fff; }
.gh-footer-nav ul { display: flex; gap: 24px; list-style: none; padding: 0; font-size: 1.4rem; }
.gh-footer-social { display: flex; gap: 16px; }
.gh-footer-social a svg { width: 20px; height: 20px; }
.gh-footer-copyright { width: 100%; font-size: 1.3rem; color: hsla(0,0%,100%,.45); padding-top: 24px; border-top: 1px solid hsla(0,0%,100%,.12); }

/* ---------------------------------------------------------------------------
   Pagination
--------------------------------------------------------------------------- */
.gh-pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: clamp(32px, 4vw, 56px) 0;
}
.gh-pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 12px;
  border-radius: 100px; font-size: 1.4rem; font-weight: 550;
  color: var(--color-secondary-text);
}
.gh-pagination .page-numbers.current { background: var(--accent-color); color: #fff; }
.gh-pagination a.page-numbers:hover { background: var(--color-lighter-gray); color: var(--color-primary-text); }

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .gh-feed { grid-template-columns: repeat(2, 1fr); }
  .gh-feed .gh-card.is-featured .gh-card-inner { grid-template-columns: 1fr; }
  .gh-feed .gh-card.is-featured .gh-card-image { order: -1; aspect-ratio: 3 / 2; }
}

@media (max-width: 640px) {
  .gh-feed { grid-template-columns: 1fr; }
  .gh-navigation-menu, .gh-navigation-actions .gh-signin { display: none; }
  .gh-burger { display: block; }
  .gh-navigation-inner.is-open { flex-wrap: wrap; height: auto; padding-block: 16px; }
  .gh-navigation-inner.is-open .gh-navigation-menu { display: flex; width: 100%; }
  .gh-navigation-inner.is-open .gh-navigation-menu ul { flex-direction: column; align-items: flex-start; gap: 14px; width: 100%; }
}
