/* =========================================================
   Drunk Diaries — site styles
   Mobile-first: base styles are for phones, then
   @media (min-width: …) blocks add the tablet/desktop layout.
   To change a brand colour, edit it once in :root below.
   ========================================================= */

:root {
  --paper: #F3E3C3;       /* aged diary-paper cream (main background) */
  --paper-dark: #E8D3AA;  /* slightly darker paper for alternating sections */
  --card: #FFF8EA;        /* light card background */
  --ink: #1A1A1A;         /* near-black text */
  --muted: #5E4E38;       /* softer brown text */
  --red: #C62828;         /* buttons and accents */
  --red-dark: #A31F1F;    /* button hover */
  --biro: #2B3A8C;        /* handwritten notes */
  --line: #D9C397;        /* borders */

  --font-display: 'Permanent Marker', Impact, 'Arial Black', sans-serif;
  --font-hand: 'Caveat', 'Comic Sans MS', cursive;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radius: 10px;
  --shadow: 0 6px 18px rgba(26, 26, 26, .16);
  --max: 1120px;

  /* Rough notebook-paper texture, laid over the colour underneath */
  --texture: url('../img/paper.jpg');
}

/* Any element with this look gets the paper grain */
body,
.site-header,
.section--alt,
.book,
.step,
.panel {
  background-image: var(--texture);
  background-size: 768px 768px;
  background-blend-mode: multiply;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

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

a { color: var(--biro); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 .5em;
  overflow-wrap: break-word;
  text-wrap: balance;
}
h1 { font-size: clamp(2.3rem, 9vw, 4.2rem); }
h2 { font-size: clamp(1.9rem, 7vw, 3rem); }
h3 { font-size: 1.55rem; }

p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

.section { padding: 64px 0; }
.section--alt { background-color: var(--paper-dark); box-shadow: inset 0 14px 18px -14px rgba(94,78,56,.35), inset 0 -14px 18px -14px rgba(94,78,56,.35); }
.section--ink { background: var(--ink); color: var(--paper); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head p { color: var(--muted); }
.section--ink .section-head p { color: var(--paper); opacity: .85; }

/* Handwritten "biro" notes */
.note {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--biro);
  margin: 0 0 .4em;
}
.section--ink .note { color: #F2B866; }

/* Skip link for keyboard users */
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--biro); outline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 24px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: var(--red);
  color: #fff;
  font: 700 1rem/1.2 var(--font-body);
  letter-spacing: .02em;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.btn:hover { background: var(--red-dark); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--card); }
.btn-row { display: grid; gap: 14px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.brand img { height: 50px; width: auto; }
.menu-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 2px solid var(--ink); border-radius: 8px;
  padding: 8px 14px; min-height: 44px;
  font: 700 .95rem var(--font-body); color: var(--ink); cursor: pointer;
}
.site-nav { display: none; }
.site-nav.is-open {
  display: block;
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  box-shadow: var(--shadow);
}
.site-nav ul { list-style: none; margin: 0; padding: 8px 20px 20px; }
.site-nav a {
  display: block; padding: 14px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.1rem;
}
.site-nav a[aria-current="page"] { color: var(--red); }
.site-nav .nav-buy { margin-top: 16px; border: 0; }
.site-nav .nav-buy a { color: #fff; border-bottom: 2px solid var(--ink); }

/* ---------- Background doodles & coffee stains (decoration only) ----------
   Each section can hold a <div class="bg-doodles"> with images placed using
   --x / --y (position), --s (size) and --r (rotation). */
.hero, .section, .page { position: relative; overflow: hidden; }
.hero > .wrap, .section > .wrap, .page > .wrap { position: relative; z-index: 1; }
.bg-doodles { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.bg-doodles img {
  position: absolute;
  left: var(--x); top: var(--y);
  width: calc(var(--s) * .7);
  transform: rotate(var(--r, 0deg));
  opacity: .2;
}
.bg-doodles img.stain { opacity: .9; }
.bg-doodles .wide-only { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 56px; }
.hero .wrap { display: grid; gap: 36px; }
.hero h1 { margin-bottom: .3em; }
.hero .lead { font-size: 1.15rem; max-width: 34em; }
.hero .price-tag { font-weight: 700; margin: 18px 0 0; }
.hero-cover { position: relative; max-width: 320px; margin: 0 auto; transform: rotate(2deg); }
.hero-cover img { border-radius: 4px; box-shadow: var(--shadow), 0 0 0 1px rgba(0,0,0,.08); }
.tape {
  position: absolute; width: 110px; height: 30px;
  background: rgba(198, 40, 40, .55);
  top: -14px; left: 50%; transform: translateX(-50%) rotate(-4deg);
}
.hero-cover .note { position: absolute; bottom: -42px; right: -6px; transform: rotate(-4deg); font-size: 1.35rem; }

/* ---------- Books ---------- */
.books { display: grid; gap: 28px; }
.book {
  background-color: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: 6px 6px 0 var(--ink);
  display: flex; flex-direction: column;
}
.book-label {
  align-self: flex-start;
  background: var(--red); color: #fff;
  font: 700 .78rem var(--font-body); letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 4px; margin-bottom: 18px;
}
.book-cover { width: 72%; max-width: 260px; margin: 0 auto 22px; box-shadow: var(--shadow); border-radius: 3px; }
.book h3 { margin-bottom: .3em; }
.book .perfect { color: var(--muted); font-size: .95rem; }
.book .perfect strong { color: var(--ink); }
.book .price { font: 400 2rem var(--font-display); color: var(--red); margin: auto 0 14px; padding-top: 8px; }

/* ---------- How it works ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; counter-reset: step; }
.step {
  background-color: var(--card);
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  padding: 24px 20px 20px 84px;
  position: relative;
  counter-increment: step;
}
.step::before {
  content: counter(step);
  position: absolute; left: 20px; top: 20px;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: grid; place-items: center;
  font: 400 1.5rem var(--font-display);
}
.step h3 { font-size: 1.35rem; margin-bottom: .25em; }
.step p { margin: 0; }

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 14px; list-style: none; margin: 0; padding: 0; }
.polaroid {
  background: #fff;
  padding: 8px 8px 30px;
  box-shadow: var(--shadow);
  position: relative;
  transform: rotate(var(--tilt, 0deg));
}
.polaroid img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.polaroid::before {
  content: ""; position: absolute; top: -9px; left: 50%;
  width: 54px; height: 18px; background: rgba(198, 40, 40, .5);
  transform: translateX(-50%) rotate(-3deg);
}
.gallery li:nth-child(4n+1) { --tilt: -2deg; }
.gallery li:nth-child(4n+2) { --tilt: 1.5deg; }
.gallery li:nth-child(4n+3) { --tilt: -1deg; }
.gallery li:nth-child(4n+4) { --tilt: 2deg; }
.gallery-cta { text-align: center; margin-top: 36px; }
.gallery-cta .note { font-size: 1.6rem; }

/* ---------- Story ---------- */
.story { max-width: 720px; margin: 0 auto; }
.story-card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 32px 22px;
  box-shadow: 6px 6px 0 var(--ink);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(43, 58, 140, .14) 31px 32px), var(--texture);
  background-size: auto, 768px 768px;
  background-blend-mode: multiply;
  color: var(--ink);
}
.story-card p { font-size: 1.08rem; line-height: 32px; }
.story-sign { font-family: var(--font-hand); font-size: 1.9rem; color: var(--biro); margin: 8px 0 0; }

/* ---------- Gift banner ---------- */
.gift { text-align: center; }
.gift h2 { color: var(--paper); }
.gift .btn { max-width: 360px; background: var(--red); border-color: var(--paper); box-shadow: 4px 4px 0 var(--paper); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--paper); padding: 48px 0 28px; border-top: 4px solid var(--red); }
.footer-grid { display: grid; gap: 28px; }
.site-footer img { height: 70px; width: auto; }
.site-footer h2 { font-family: var(--font-body); font-size: .85rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #F2B866; margin-bottom: .8em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 10px; }
.site-footer a { color: var(--paper); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-small { border-top: 1px solid rgba(243, 227, 195, .2); margin-top: 32px; padding-top: 20px; font-size: .9rem; opacity: .8; }

/* ---------- Simple pages (contact, privacy, 404) ---------- */
.page { padding: 48px 0 72px; }
.page .wrap { max-width: 720px; }
.panel { background-color: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 28px 20px; box-shadow: 6px 6px 0 var(--ink); }
.page h2 { font-size: 1.6rem; margin-top: 1.2em; }

form .field { margin-bottom: 18px; }
form label { display: block; font-weight: 700; margin-bottom: 6px; }
form input, form textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font: 1rem var(--font-body);
  color: var(--ink);
}
form textarea { min-height: 160px; resize: vertical; }
.hidden-field { display: none; }
.form-status { margin-top: 16px; padding: 14px; border-radius: 8px; font-weight: 600; }
.form-status[hidden] { display: none; }
.form-status.ok { background: #E3F1E1; color: #1E5E22; }
.form-status.err { background: #FBE0DD; color: #8E1F18; }

.socials { display: grid; gap: 12px; margin-top: 24px; }
.social { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.social svg { width: 28px; height: 28px; flex: none; }
.site-footer .social { font-weight: 400; }
.site-footer .social svg { width: 22px; height: 22px; }

/* =========================================================
   Tablet and up
   ========================================================= */
@media (min-width: 640px) {
  .btn { width: auto; }
  .btn-row { display: flex; flex-wrap: wrap; gap: 16px; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 26px 22px; }
  .story-card { padding: 40px 40px; }
  .panel { padding: 36px 36px; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

/* =========================================================
   Desktop
   ========================================================= */
@media (min-width: 960px) {
  .section { padding: 88px 0; }
  .bg-doodles img { width: var(--s); opacity: .24; }
  .bg-doodles img.stain { opacity: .9; }
  .bg-doodles .wide-only { display: block; }
  .menu-toggle { display: none; }
  .site-nav, .site-nav.is-open { display: block; position: static; box-shadow: none; border: 0; background: none; }
  .site-nav ul { display: flex; align-items: center; gap: 26px; padding: 0; }
  .site-nav a { border: 0; padding: 6px 0; font-size: 1rem; }
  .site-nav a:hover { color: var(--red); }
  .site-nav .nav-buy { margin: 0; }
  .site-nav .nav-buy a { min-height: 44px; padding: 8px 18px; }

  .hero { padding: 64px 0 88px; }
  .hero .wrap { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 56px; }
  .hero-cover { max-width: 380px; }

  .books { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .gallery { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
