/*
 * Potato Post — Sandra theme stylesheet
 *
 * One file, linked on every page. Everything it references sits beside it
 * (fonts/, img/) and is addressed relatively, so a published bundle works
 * from a subfolder as well as a domain root.
 *
 * Class prefix: pp-
 */

/* ---------- Fonts (self-hosted, variable, latin subset) ---------- */

@font-face {
  font-family: 'Noto Serif';
  src: url('fonts/noto-serif.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Serif';
  src: url('fonts/noto-serif-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Fredoka';
  src: url('fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --pp-blue:       #145186;
  --pp-blue-deep:  #0d3a61;
  --pp-green:      #2e7d32;   /* darkened from #4caf50 for AA contrast with white */
  --pp-green-soft: #e7f2e8;
  --pp-rust:       #b1371d;
  --pp-rust-soft:  #f8e8e4;
  --pp-night:      #07172c;
  --pp-ink:        #2b2b2b;
  --pp-ink-soft:   #5a5a5a;
  --pp-paper:      #fdfdfb;
  --pp-line:       #e6e3dc;

  --pp-font-body:    'Noto Serif', Georgia, 'Times New Roman', serif;
  --pp-font-display: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;

  --pp-radius:  10px;
  --pp-shadow:  0 2px 4px rgba(0, 0, 0, .18), 0 10px 28px rgba(0, 0, 0, .22);
  --pp-wrap:    960px;
  --pp-measure: 42rem;
  --pp-gutter:  clamp(16px, 4vw, 32px);
}

/* Category colour, set on any element and read by its children. */
.pp-cat-none    { --pp-cat: var(--pp-blue);  --pp-cat-soft: #e6eef6;             --pp-cat-icon: url('img/potato_icon.png');  --pp-cat-pattern: url('img/pattern_potato.svg'); }
.pp-cat-general { --pp-cat: var(--pp-green); --pp-cat-soft: var(--pp-green-soft); --pp-cat-icon: url('img/potato_icon.png');  --pp-cat-pattern: url('img/pattern_potato.svg'); }
.pp-cat-games   { --pp-cat: var(--pp-rust);  --pp-cat-soft: var(--pp-rust-soft);  --pp-cat-icon: url('img/joypad_icon.png'); --pp-cat-pattern: url('img/pattern_joypad.svg'); }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--pp-font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--pp-ink);
  background: var(--pp-night);
  display: flex;
  flex-direction: column;
}

/* The farm at night, fixed behind everything. A pseudo-element rather than
   background-attachment: fixed, which iOS ignores. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--pp-night) url('img/potato_post_background.jpg') center bottom / cover no-repeat;
}

img { max-width: 100%; height: auto; }

a { color: var(--pp-blue); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid #ffd54a;
  outline-offset: 2px;
}

.pp-wrap {
  width: 100%;
  max-width: calc(var(--pp-wrap) + 2 * var(--pp-gutter));
  margin-inline: auto;
  padding-inline: var(--pp-gutter);
}


/* Text for screen readers only. */
.pp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ================================================================
   Block: pp_masthead  (slot: menu)
   ================================================================ */

.pp-masthead {
  background: var(--pp-blue);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  position: relative;
  z-index: 2;
}

.pp-masthead__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding-block: 12px;
}

.pp-masthead__brand {
  display: block;
  width: 233px;               /* logo is 700 × 120 */
  height: 40px;
  margin-right: auto;
  background: url('img/potato_post_logo.png') left center / contain no-repeat;
}

.pp-masthead__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pp-masthead__nav a,
.pp-masthead__social {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  color: #fff;
  font-family: var(--pp-font-display);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color .15s;
}

.pp-masthead__nav a:hover,
.pp-masthead__social:hover { background: rgba(255, 255, 255, .14); }

.pp-masthead__nav a[aria-current] { background: rgba(255, 255, 255, .22); }

.pp-masthead__social { font-weight: 600; }

@media (max-width: 560px) {
  .pp-masthead__brand { width: 187px; height: 32px; }
  .pp-masthead__nav { order: 3; width: 100%; margin-inline: -12px; }
}

/* ================================================================
   Block: pp_intro  (role: page_title)
   ================================================================ */

.pp-intro {
  color: #fff;
  padding-block: clamp(28px, 6vw, 56px) 8px;
}

.pp-intro__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  background: var(--pp-cat);
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.pp-intro__eyebrow::before {
  content: '';
  width: 20px;
  height: 20px;
  background: var(--pp-cat-icon) center / contain no-repeat;
}

.pp-intro__title {
  margin: 0;
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  text-wrap: balance;
}

.pp-intro__text {
  max-width: var(--pp-measure);
  margin: 12px 0 0;
  color: rgba(255, 255, 255, .82);
  font-size: 1.125rem;
}

.pp-intro__text p { margin: 0; }

/* ================================================================
   Block: pp_post_list  (role: entry_list)
   ================================================================ */

.pp-posts { padding-block: 24px 64px; }

.pp-posts__list {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pp-posts__empty {
  color: #fff;
  font-style: italic;
}

/* ---- One post card ---- */

.pp-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr;
  background: var(--pp-paper);
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow);
  overflow: hidden;
  transition: box-shadow .2s ease;
}

/* The card stays put on hover; only its shadow deepens and the button tilts. */
.pp-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, .2), 0 16px 36px rgba(0, 0, 0, .28);
}

.pp-card:has(:focus-visible) { outline: 3px solid #ffd54a; outline-offset: 3px; }
.pp-card :focus-visible { outline: none; }

/* The patterned strip: category colour, with its icon scattered over it. */
.pp-card__date {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 22px 8px;
  overflow: hidden;
  background: var(--pp-cat);
  color: #fff;
  text-align: center;
}

.pp-card__date::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--pp-cat-pattern) 0 0 / 64px 64px repeat;
  opacity: .18;
}

.pp-card__date time {
  display: flex;
  flex-direction: column;
  font-family: var(--pp-font-display);
  line-height: 1.15;
}

.pp-card__day   { font-size: 1.75rem; font-weight: 600; }
.pp-card__month { font-size: 1rem;    font-weight: 500; }
.pp-card__year  { font-size: .875rem; opacity: .85; }

.pp-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px clamp(20px, 3vw, 32px) 24px;
  min-width: 0;
}

.pp-card__cat {
  margin: 0;
  color: var(--pp-cat);
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: .8125rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pp-card__title {
  margin: 0;
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  line-height: 1.2;
  text-wrap: balance;
}

.pp-card__title a {
  color: var(--pp-ink);
  text-decoration: none;
}

/* The whole card is the link's hit area. */
.pp-card__title a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.pp-card__excerpt { color: var(--pp-ink-soft); }
.pp-card__excerpt p { margin: 0 0 .6em; white-space: pre-line; }   /* excerpts are plain text; keep their paragraph breaks */
.pp-card__excerpt p:last-child { margin-bottom: 0; }

.pp-card__more {
  align-self: flex-end;
  margin-top: 4px;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--pp-cat);
  color: #fff;
  font-family: var(--pp-font-display);
  font-weight: 500;
  transition: transform .12s ease;
  backface-visibility: hidden;   /* keeps the tilt from nudging neighbouring text */
}

.pp-card:hover .pp-card__more { transform: rotate(1.5deg) scale(1.04); }

/* Stacked on narrow screens: the strip becomes a band across the top. */
@media (max-width: 600px) {
  .pp-card { grid-template-columns: 1fr; }

  .pp-card__date { justify-content: flex-start; padding: 10px 20px; }

  .pp-card__date time { flex-direction: row; align-items: baseline; gap: 6px; }
  .pp-card__day   { font-size: 1.125rem; }
  .pp-card__year  { font-size: 1rem; opacity: 1; }

  .pp-card__more { align-self: flex-start; }
}

/* ================================================================
   Block: pp_text  (role: text)
   ================================================================ */

.pp-textblock { padding-block: 24px; }

.pp-textblock__title {
  max-width: var(--pp-measure);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 56px) clamp(20px, 7vw, 96px) 0;
  box-sizing: content-box;
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

.pp-textblock__title + .pp-rich { padding-top: 16px; }

/* ================================================================
   Entry template: entries/blog.liquid
   ================================================================ */

.pp-entry { padding-block: 24px 64px; }

/* ---- Breadcrumb ---- */

.pp-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  font-family: var(--pp-font-display);
  font-weight: 500;
  font-size: .9375rem;
}

.pp-crumbs li { display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .75); }

.pp-crumbs li + li::before {
  content: '›';
  color: rgba(255, 255, 255, .5);
}

.pp-crumbs a {
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  text-decoration: none;
}

.pp-crumbs a:hover { background: rgba(255, 255, 255, .24); }
.pp-crumbs a.pp-crumbs__cat { background: var(--pp-cat); }

.pp-crumbs [aria-current] {
  max-width: 36ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .pp-crumbs li:last-child { display: none; }
}

/* ---- Article ---- */

.pp-article {
  background: var(--pp-paper);
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow);
  overflow: hidden;
}

.pp-article__head { position: relative; }

.pp-article__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  background: var(--pp-cat-soft);
}

.pp-article__titlebox {
  padding: 24px clamp(20px, 5vw, 48px);
  background: var(--pp-cat);
  color: #fff;
}

/* With an image, the title panel sits over its bottom-left corner. */
.pp-article__head--image .pp-article__titlebox {
  position: absolute;
  left: 0;
  bottom: 0;
  max-width: min(75%, 40rem);
  border-radius: 0 var(--pp-radius) 0 0;
  background: color-mix(in srgb, var(--pp-cat) 92%, transparent);
}

.pp-article__title {
  margin: 0;
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.15;
  text-wrap: balance;
}

.pp-article__date {
  display: block;
  margin-top: 6px;
  font-family: var(--pp-font-display);
  font-weight: 500;
  opacity: .9;
}

@media (max-width: 600px) {
  .pp-article__head--image .pp-article__titlebox {
    position: static;
    max-width: none;
    border-radius: 0;
    background: var(--pp-cat);
  }
}

/* ---- Rich text (entry body, and any richtext field) ---- */

.pp-rich {
  padding: clamp(28px, 6vw, 64px) clamp(20px, 7vw, 96px);
  font-size: 1.125rem;
  line-height: 1.75;
}

.pp-rich > * { max-width: var(--pp-measure); margin-inline: auto; }

.pp-rich > :first-child { margin-top: 0; }
.pp-rich > :last-child  { margin-bottom: 0; }

.pp-rich p, .pp-rich ul, .pp-rich ol, .pp-rich blockquote, .pp-rich pre { margin-block: 0 1.1em; }

.pp-rich h2, .pp-rich h3 {
  font-family: var(--pp-font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--pp-ink);
  margin-block: 1.6em .5em;
}

.pp-rich h2 { font-size: 1.6rem; }
.pp-rich h3 { font-size: 1.3rem; }

.pp-rich li { margin-bottom: .35em; }
.pp-rich li::marker { color: var(--pp-cat, var(--pp-blue)); font-weight: 700; }

.pp-rich blockquote {
  padding: .2em 0 .2em 1.1em;
  border-left: 4px solid var(--pp-cat, var(--pp-blue));
  color: var(--pp-ink-soft);
  font-style: italic;
}

.pp-rich code {
  padding: .1em .35em;
  border-radius: 4px;
  background: #f0eee8;
  font-size: .9em;
}

.pp-rich pre {
  padding: 16px 20px;
  border-radius: 8px;
  background: #1e2630;
  color: #f2f2f2;
  font-size: .9rem;
  line-height: 1.55;
  overflow-x: auto;
}

.pp-rich pre code { padding: 0; background: none; font-size: inherit; }

.pp-rich img { display: block; border-radius: 8px; margin-block: 1.4em; }

/* ---- More posts ---- */

.pp-more { margin-top: 48px; }

.pp-more__title {
  margin: 0 0 16px;
  color: #fff;
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: 1.5rem;
}

.pp-more__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pp-mini {
  position: relative;
  height: 100%;
  padding: 16px 18px 18px;
  border-top: 6px solid var(--pp-cat);
  border-radius: var(--pp-radius);
  background: var(--pp-paper);
  box-shadow: var(--pp-shadow);
  transition: transform .2s ease;
}

.pp-mini:hover { transform: translateY(-3px); }

.pp-mini__date {
  display: block;
  margin-bottom: 4px;
  color: var(--pp-cat);
  font-family: var(--pp-font-display);
  font-weight: 500;
  font-size: .875rem;
}

.pp-mini__title {
  margin: 0;
  font-family: var(--pp-font-display);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.25;
}

.pp-mini__title a { color: var(--pp-ink); text-decoration: none; }
.pp-mini__title a::after { content: ''; position: absolute; inset: 0; }

/* ================================================================
   Block: pp_footer  (slot: footer)
   ================================================================ */

.pp-footer {
  margin-top: auto;   /* keeps the footer down on short pages */
  padding-block: 28px;
  background: rgba(10, 16, 12, .72);
  color: rgba(255, 255, 255, .85);
  font-size: .9375rem;
  text-align: center;
  backdrop-filter: blur(4px);
}

.pp-footer p { margin: 0; }
.pp-footer a { color: #fff; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .pp-card:hover .pp-card__more, .pp-mini:hover { transform: none; }
}
