/* =====================================================================
   CHEZ HADI — stylesheet
   1. DESIGN TOKENS  (change the look of the whole site here)
   2. Base           3. Layout shell      4. Gallery
   5. Post page      6. Recipe/text pages 7. Small screens
   ===================================================================== */

/* ---------- 1. DESIGN TOKENS ---------- */
@font-face { font-family: "Young Serif"; src: url(fonts/young-serif.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url(fonts/hanken-grotesk.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url(fonts/hanken-grotesk-italic.woff2) format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  /* Fonts: display = wordmark & titles, text = everything else */
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-text: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Colours. Cool, quiet paper so the warm wood and blue plates in the photos carry the colour. */
  --paper: #eceff0;       /* page background */
  --ink: #17232f;         /* main text */
  --muted: #5a6772;       /* secondary text (contrast 4.9:1 on paper) */
  --line: #d2d9dd;        /* hairlines */
  --accent: #2b4f75;      /* "plate blue": links, focus, Instagram tile */
  --accent-ink: #ffffff;  /* text on accent */
  --badge-bg: #f7f4ee;    /* recipe badge on photos */
  --badge-ink: #7a2c2c;

  /* Gallery */
  --cols: 3;              /* columns on desktop (tablet: same, phone: see section 7) */
  --gap: 6px;             /* space between tiles */
  --tile-ratio: 3 / 4;    /* crop of tiles in the grid: 1 / 1, 4 / 5, 3 / 4 … (photos are never cropped on their own page) */

  /* Layout */
  --rail: 17rem;          /* width of the left column on desktop */
  --pad: clamp(1rem, 2.4vw, 2rem);
  --measure: 40rem;       /* max width of reading text */
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10181f; --ink: #e8edf0; --muted: #98a6b1; --line: #25323d;
    --accent: #8db6e0; --accent-ink: #0d1822; --badge-bg: #1b252e; --badge-ink: #f0b3a8;
  }
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.65 var(--font-text); }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .5rem; top: -4rem; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 10; }
.skip:focus { top: .5rem; }
.button { display: inline-block; padding: .55rem 1rem; border: 1.5px solid var(--accent); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .95rem; }
.button:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- 3. LAYOUT SHELL ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; align-self: start; height: 100vh; padding: 2rem 1.5rem 1rem var(--pad); }
.wordmark { display: flex; flex-direction: column; font: 400 clamp(2.6rem, 4.2vw, 3.6rem)/.95 var(--font-display); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.wordmark span:last-child { color: var(--accent); }
.tagline { margin: 1rem 0 2rem; color: var(--muted); font-size: .98rem; max-width: 14rem; }
.nav { display: flex; flex-direction: column; gap: .15rem; font-weight: 600; }
.nav a { color: var(--ink); text-decoration: none; padding: .2rem 0; width: fit-content; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current] { border-bottom-color: var(--accent); }
.langs { display: flex; gap: .9rem; margin-top: 1.6rem; font-size: .85rem; font-weight: 700; letter-spacing: .08em; }
.langs a { color: var(--muted); text-decoration: none; padding: .15rem 0; border-bottom: 2px solid transparent; }
.langs a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.foot { position: fixed; left: 0; bottom: 0; width: var(--rail); padding: 0 1.5rem 1.4rem var(--pad); font-size: .85rem; color: var(--muted); }
.foot ul { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .1rem 1rem; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
main { padding: var(--pad) var(--pad) 4rem 0; min-width: 0; }
.pagehead { margin: .5rem 0 1.6rem; }
.pagehead h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.pagehead p { color: var(--muted); margin: .4rem 0 0; }
@media (max-height: 560px) { .foot { position: static; width: auto; } }

/* ---------- 4. GALLERY ---------- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gap); }
.tile { position: relative; display: block; aspect-ratio: var(--tile-ratio); overflow: hidden; background: var(--c, var(--line)); color: #fff; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile__label { position: absolute; inset: auto 0 0 0; padding: 2.5rem .9rem .8rem; font: 400 1.05rem/1.25 var(--font-display);
  background: linear-gradient(to top, rgb(8 14 20 / .78), transparent); opacity: 0; transition: opacity .18s ease; }
.tile:hover .tile__label, .tile:focus-visible .tile__label { opacity: 1; }
.tile__badge { position: absolute; top: .55rem; right: .55rem; background: var(--badge-bg); color: var(--badge-ink); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .22rem .5rem; border-radius: 3px; line-height: 1.2; }
.tile__badge--multi { background: none; color: #fff; padding: .2rem; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .6)); }
.tile--ig { display: grid; place-items: center; text-align: center; padding: 1.2rem; background: var(--accent); color: var(--accent-ink); text-decoration: none; font: 400 clamp(1.1rem, 2vw, 1.6rem)/1.2 var(--font-display); }
.tile--ig:hover { filter: brightness(1.1); }
.grid--captioned { row-gap: 1.6rem; }
.cap { margin: .55rem 0 0; display: grid; line-height: 1.3; }
.cap a { color: var(--ink); text-decoration: none; font: 400 1.15rem/1.25 var(--font-display); }
.cap a:hover { text-decoration: underline; }
.cap span { color: var(--muted); font-size: .92rem; }
@media (hover: none) { .tile__label { display: none; } }

/* ---------- 5. POST PAGE (gallery posts) ---------- */
.post { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(16rem, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.post__media { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--gap); scrollbar-width: thin; }
.slide { flex: 0 0 100%; margin: 0; scroll-snap-align: start; display: grid; justify-items: start; }
.post__media--multi .slide { flex-basis: 94%; }
.slide img { width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 2rem); }
.post__body { position: sticky; top: var(--pad); }
.caption { font-size: 1.1rem; max-width: var(--measure); }
.caption p { margin: 0 0 .9em; }
.note, .meta { color: var(--muted); font-size: .9rem; margin: .4rem 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 1rem 0; }
.tags a { display: block; padding: .15rem .65rem; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; color: var(--muted); text-decoration: none; }
.tags a:hover { border-color: var(--accent); color: var(--accent); }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; margin: 1.2rem 0; }
.crumb { margin: 0 0 1.2rem; font-size: .92rem; }
.crumb a { color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.pager a { display: grid; max-width: 48%; color: var(--ink); text-decoration: none; font: 400 1.05rem/1.3 var(--font-display); }
.pager a[rel=next] { text-align: right; margin-left: auto; }
.pager small { font: 600 .72rem/1.6 var(--font-text); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pager a:hover { color: var(--accent); }

/* ---------- 6. RECIPE & TEXT PAGES ---------- */
.recipe { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.recipe__media { margin: 0; position: sticky; top: var(--pad); }
.recipe__media img { width: auto; max-width: 100%; max-height: calc(100vh - 2 * var(--pad)); margin: 0 auto; }
.recipe__text, .textpage { max-width: var(--measure); }
.recipe h1, .textpage h1 { font-size: clamp(2rem, 3.6vw, 2.9rem); }
.sub { font: 400 1.3rem/1.3 var(--font-display); color: var(--accent); margin: .5rem 0 0; }
.prose { margin-top: 1.4rem; }
.prose h2 { font-size: 1.7rem; margin: 2.2rem 0 .8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.prose h3 { font: 700 .82rem/1.3 var(--font-text); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 1.6rem 0 .5rem; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin: .3rem 0; padding-left: .2rem; }
.prose ol li::marker { font-weight: 700; color: var(--accent); }
.prose ul li::marker { color: var(--muted); }
.textpage { margin: 0; }

/* ---------- 7. SMALL SCREENS ---------- */
@media (max-width: 999px) {
  .shell { display: block; }
  .rail { position: static; height: auto; padding: 1.1rem var(--pad) .6rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.4rem; }
  .wordmark { flex-direction: row; gap: .35em; font-size: 2rem; }
  .tagline { display: none; }
  .nav { flex-direction: row; gap: 1.1rem; order: 3; width: 100%; }
  .langs { margin: 0 0 0 auto; }
  .foot { position: static; width: auto; padding: 1.5rem var(--pad) 2rem; }
  main { padding: .4rem var(--gap) 2rem; }
  .pagehead, .recipe__text, .textpage, .post__body { padding-inline: calc(var(--pad) - var(--gap)); }
  .post, .recipe { grid-template-columns: 1fr; gap: 1.2rem; }
  .post__body, .recipe__media { position: static; }
  .slide img, .recipe__media img { max-height: 80vh; }
}
@media (max-width: 559px) { :root { --cols: 2; --gap: 4px; } }
