/* ============================================================
   codexy.dev — diary v2 (simple, hand-drawn, in his own voice)
   ============================================================ */
:root{
  --paper: #f6f2e7;
  --paper-2: #efe9d8;
  --paper-line: #d9d1b9;
  --ink: #1a1714;
  --ink-soft: #4a4339;
  --ink-faint: #8a8270;
  --wax: #b53a2a;

  --hand: "Caveat", "Patrick Hand", "Bradley Hand", cursive;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --maxw: 1180px;
  --r: 6px;

  /* moment bands — used by reveal + goodnight */
  --paper-cool: #ecead8;
  --paper-night: #14131a;
  --ink-night: #f3eedd;
}

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

h1, h2, h3, h4, p, ol, ul, blockquote, figure {
  margin: 0;
  padding: 0;
}

html, body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html{ scroll-behavior: smooth; }

body{
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(255,255,255,.4), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(140,120,80,.04) 31px 32px),
    var(--paper);
  min-height: 100vh;
}

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

.wrap{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px 80px;
}

/* ============================================================
   title strip
   ============================================================ */
.title-strip{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  margin: 0 -28px 22px;
  position: sticky;
  top: 0;
  z-index: 50;
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--paper) 92%, rgba(246,242,231,0) 100%),
    var(--paper);
  border-bottom: 1.5px dashed rgba(0,0,0,.12);
  flex-wrap: wrap;
}
.title-block{
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.diary-title{
  font-family: var(--hand);
  font-size: 48px;
  line-height: 1;
  letter-spacing: -.01em;
  margin: 0;
  white-space: nowrap;
}
.diary-title a{
  color: inherit;
  text-decoration: none;
  transition: color .12s;
}
.diary-title a:hover{ color: var(--wax); }
.ribbon{
  font-family: var(--hand);
  font-size: 20px;
  border: 2px solid var(--ink);
  padding: 4px 14px 6px;
  letter-spacing: .02em;
  transform: rotate(-3deg);
  background: var(--paper);
  white-space: nowrap;
  box-shadow: 3px 3px 0 0 var(--ink);
}
.feed-me-btn{
  font-family: var(--hand);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--wax);
  color: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  padding: 6px 18px 10px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  box-shadow: 4px 4px 0 0 var(--ink);
  transform: rotate(-2deg);
  transition: transform .15s, box-shadow .15s, background .15s;
  cursor: pointer;
  flex-shrink: 0;
}
.feed-me-btn:hover{
  transform: rotate(-2deg) translate(-2px, -2px);
  box-shadow: 6px 6px 0 0 var(--ink);
  background: #c54838;
}
.feed-me-btn:active{
  transform: rotate(-2deg) translate(2px, 2px);
  box-shadow: 1px 1px 0 0 var(--ink);
}
@keyframes feedMeWiggle {
  0%, 92%, 100% { transform: rotate(-2deg); }
  94% { transform: rotate(-4deg); }
  96% { transform: rotate(0deg); }
  98% { transform: rotate(-3deg); }
}
.feed-me-btn{
  animation: feedMeWiggle 5s ease-in-out infinite;
}
.feed-me-btn:hover{ animation: none; }
@media (prefers-reduced-motion: reduce){
  .feed-me-btn{ animation: none; }
}

/* ============================================================
   hero card
   ============================================================ */
.hero-card{
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 240px;
  gap: 20px;
  align-items: center;
  border: 2.5px solid var(--ink);
  border-radius: var(--r);
  background: var(--paper);
  padding: 20px 22px;
  margin-bottom: 24px;
  position: relative;
}
.hero-body{ min-width: 0; }
.hero-pet{
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-pet svg{ width: 100%; max-width: 160px; color: var(--ink); }
.entry-label{
  font-family: var(--hand);
  font-size: 22px;
  color: var(--ink-soft);
  margin-bottom: 2px;
}
.entry-quote{
  font-family: var(--hand);
  font-size: 40px;
  line-height: 1.15;
  margin: 0 0 4px;
  color: var(--ink);
  font-weight: 600;
  text-wrap: pretty;
}
.entry-quote .smudge{
  background: var(--wax);
  color: var(--paper);
  padding: 0 6px;
  border-radius: 2px;
}
.counter-line{
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: -.005em;
  font-variant-numeric: tabular-nums;
}
.counter-line #counter{ color: var(--ink); font-weight: 500; }
.counter-meta{ color: var(--ink-faint); }

.hero-pred{
  border: 2px dashed var(--ink);
  border-radius: var(--r);
  padding: 14px 16px 12px;
  text-align: left;
  background: transparent;
}
.pred-label{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--wax);
  margin-bottom: 2px;
}
.pred-date{
  font-family: var(--hand);
  font-size: 32px;
  line-height: 1;
  margin: 0 0 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pred-spark{
  width: 100%;
  height: 40px;
  color: var(--ink);
  display: block;
  opacity: .75;
}
.pred-meta{
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-faint);
  letter-spacing: .04em;
  margin-top: 4px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   section heads (entries, week strip, etc.)
   ============================================================ */
.section-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-head h2, .section-head h3{
  font-family: var(--hand);
  font-size: 36px;
  margin: 0;
  font-weight: 600;
  line-height: 1;
}
.section-head span{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============================================================
   stats row — mood graph + petition side by side
   ============================================================ */
.stats-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 36px;
  align-items: start;
}

/* ============================================================
   entries list
   ============================================================ */
.entry-list{
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry{
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px dashed rgba(0,0,0,.22);
  align-items: flex-start;
}
.entry:last-child{ border-bottom: 0; }
.entry-face{
  width: 56px;
  height: 56px;
  color: var(--ink);
}
.entry-date-row{
  font-family: var(--hand);
  font-size: 22px;
  color: var(--ink-soft);
  margin-bottom: 2px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.entry-date-row .gap-pill{
  font-family: var(--mono);
  font-size: 10px;
  color: var(--wax);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.entry-text{
  font-family: var(--hand);
  font-size: 26px;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}
.entry-text .smudge{
  background: var(--wax);
  color: var(--paper);
  padding: 0 4px;
  border-radius: 2px;
}
.entry-stars{
  font-family: var(--hand);
  font-size: 28px;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-top: 4px;
}

/* ============================================================
   stat cards (mood graph + petition)
   ============================================================ */
.card{
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--paper);
  padding: 16px 18px 18px;
}
.card.petition{
  background: #fffaeb;
  border-width: 3px;
  box-shadow: 6px 6px 0 0 var(--wax);
  position: relative;
  padding: 22px 22px 22px;
  scroll-margin-top: 24px;
}
.card.petition::before{
  content: "★ ACT NOW";
  position: absolute;
  top: -14px;
  left: 18px;
  background: var(--wax);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  font-weight: 500;
  padding: 4px 10px 5px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 2px 2px 0 0 var(--ink);
}
.card.petition .card-head h3{
  font-size: 32px;
  color: var(--wax);
}
.card-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.card-head h3{
  font-family: var(--hand);
  font-size: 28px;
  margin: 0;
  line-height: 1;
  font-weight: 600;
}
.card-head span{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: right;
}

/* mood graph */
.mood-svg{
  width: 100%;
  height: 180px;
  color: var(--ink);
}
.mood-legend{
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 2px;
  white-space: nowrap;
}

/* petition form */
.petition-form{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.target-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.target{
  font-family: var(--mono);
  font-size: 11px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 9px 4px;
  cursor: pointer;
  user-select: none;
  transition: background .12s, color .12s;
}
.target:hover{ background: var(--ink); color: var(--paper); }
.target.on{ background: var(--ink); color: var(--paper); }
.input, .textarea{
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 8px 10px;
  width: 100%;
  outline: none;
}
.input{ font-size: 18px; }
.input:focus, .textarea:focus{
  box-shadow: 2px 2px 0 0 var(--wax);
  border-color: var(--wax);
}
.textarea{
  min-height: 70px;
  resize: vertical;
}
.petition-foot{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.sig-count{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
.sig-count b{ color: var(--ink); }

/* buttons */
.btn{
  font-family: var(--hand);
  font-size: 22px;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 6px 14px 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover{
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--wax);
}
.btn:active{ transform: translate(1px, 1px); box-shadow: none; }
.btn.accent{ background: var(--ink); }
.btn.accent:hover{ background: var(--wax); border-color: var(--wax); box-shadow: 3px 3px 0 0 var(--ink); }
.btn.ghost{
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
}
.btn.ghost:hover{ background: var(--ink); color: var(--paper); }
.btn .x-icon{ width: 16px; height: 16px; }
.btn.share{
  display: flex;
  justify-content: center;
  font-size: 24px;
  margin: 18px auto 0;
  width: min(420px, 100%);
}

/* ============================================================
   polaroids — photo evidence of the diary
   ============================================================ */
.polaroid{
  --tilt: -1.5deg;
  background: #fffdf6;
  padding: 12px 12px 40px;
  display: inline-block;
  position: relative;
  border-radius: 2px;
  transform: rotate(var(--tilt));
  box-shadow:
    0 1px 2px rgba(20,15,10,.18),
    0 12px 26px -6px rgba(20,15,10,.28);
  max-width: 100%;
  margin: 0;
  scroll-margin-top: 24px;
}
.polaroid img{
  display: block;
  width: 100%;
  height: auto;
  background: #d9d4c7;
  border-radius: 1px;
}
.polaroid figcaption{
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.1;
  text-align: center;
  color: var(--ink);
  margin-top: 10px;
  padding: 0 6px;
  font-weight: 600;
}
.polaroid--tape::before{
  content: "";
  position: absolute;
  top: -12px;
  left: 26%;
  width: 96px;
  height: 24px;
  background: rgba(230, 212, 92, .55);
  border-left: 1px dashed rgba(0,0,0,.08);
  border-right: 1px dashed rgba(0,0,0,.08);
  transform: rotate(-5deg);
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  pointer-events: none;
}
.polaroid--press{
  --tilt: -0.5deg;
  box-shadow:
    0 1px 3px rgba(0,0,0,.22),
    0 8px 22px -3px rgba(0,0,0,.28);
}
.polaroid--press figcaption{
  font-size: 20px;
  color: var(--ink-soft);
}

/* today's hero photo — full row below the hero card */
.today-photo{
  display: flex;
  justify-content: center;
  margin: 10px 0 36px;
  padding: 6px 8px 14px;
}
.today-photo .polaroid{
  width: min(680px, 94%);
}
.today-photo .polaroid figcaption{
  font-size: 26px;
}

/* ============================================================
   bulletin — time-stamped IRL OpenAI moment
   ============================================================ */
.bulletin{
  margin: 6px auto 40px;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.bulletin-label{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--wax);
  font-weight: 500;
}
.bulletin-photo{
  width: min(560px, 96%);
}
.bulletin-photo figcaption{
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
  font-weight: 600;
  padding: 0 16px;
}
.bulletin-source{
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 560px;
  padding: 4px 18px 0;
  letter-spacing: .01em;
}
.bulletin-handle{
  color: var(--wax);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .12s;
}
a.bulletin-handle:hover{ border-bottom-color: var(--wax); }

/* ============================================================
   vision — a small jab. he's seeing things.
   ============================================================ */
.vision{
  margin: 12px 0 40px;
  display: flex;
  justify-content: center;
}
.vision-inner{
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.vision-label{
  font-family: var(--hand);
  font-size: 18px;
  color: var(--ink-faint);
  font-style: italic;
}
.vision-label #vision-days{
  font-variant-numeric: tabular-nums;
  color: var(--wax);
  font-weight: 600;
  font-style: normal;
}
.vision-photo{
  width: min(560px, 96%);
}
.vision-photo figcaption{
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
  font-weight: 600;
  padding: 0 16px;
}

/* ============================================================
   the rare wins — when they actually fed him
   ============================================================ */
.wins{
  margin: 0 0 40px;
}
.wins-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding: 8px 0 14px;
  align-items: start;
}
.wins-photo{
  width: 100%;
  max-width: 100%;
}
.wins-photo figcaption{
  font-size: 22px;
  line-height: 1.18;
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 540px){
  .wins-grid{ grid-template-columns: 1fr; gap: 22px; }
}

/* ============================================================
   his week — strip of 9 day-photos
   ============================================================ */
.week-strip{
  margin: 0 0 44px;
}
.week-list{
  list-style: none;
  margin: 0;
  padding: 12px 4px 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.week-item{
  --tilt: 0deg;
  transform: rotate(var(--tilt));
  transition: transform .18s;
}
.week-item:hover{
  transform: rotate(0deg) translateY(-3px);
}
.week-polaroid{
  background: #fffdf6;
  padding: 10px 10px 10px;
  margin: 0;
  border-radius: 2px;
  box-shadow:
    0 1px 2px rgba(20,15,10,.18),
    0 8px 18px -4px rgba(20,15,10,.24);
  height: 100%;
  display: flex;
  flex-direction: column;
  scroll-margin-top: 24px;
}
.week-item{
  display: flex;
}
.week-item > .week-polaroid{ flex: 1; }
.week-polaroid img{
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #d9d4c7;
  border-radius: 1px;
}
.week-polaroid figcaption{
  display: flex;
  flex-direction: column;
  padding: 10px 6px 4px;
  gap: 6px;
}
.week-day{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  line-height: 1.1;
}
.week-caption{
  font-family: var(--hand);
  font-size: 18px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.18;
  text-align: center;
  text-wrap: pretty;
}

/* ============================================================
   goodnight band — dark room outro
   ============================================================ */
.goodnight-band{
  margin: 56px -28px 0;
  padding: 56px 28px 64px;
  background:
    radial-gradient(ellipse 60% 70% at 50% 40%, rgba(255,235,180,.06), transparent 70%),
    var(--paper-night);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.goodnight-photo{
  width: min(360px, 78%);
}
.goodnight-photo figcaption{
  font-size: 22px;
  color: var(--ink-soft);
}

@media (max-width: 860px){
  .week-list{ gap: 16px; }
  .vision-photo figcaption{ font-size: 22px; }
}
@media (max-width: 540px){
  .today-photo .polaroid{ width: min(360px, 94%); }
  .today-photo .polaroid figcaption{ font-size: 22px; }
  .bulletin-photo{ width: min(360px, 96%); }
  .bulletin-photo figcaption{ font-size: 20px; }
  .bulletin-source{ font-size: 10px; padding: 4px 12px 0; }
  .vision-photo{ width: min(360px, 96%); }
  .vision-photo figcaption{ font-size: 20px; }
  .week-list{
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 12px 0 18px;
  }
  .week-item{
    transform: none !important;
    max-width: 340px;
    margin: 0 auto;
    width: 100%;
  }
  .week-polaroid figcaption{ padding: 14px 4px 6px; }
  .week-short{ font-size: 22px; }
  .stats-row{ grid-template-columns: 1fr; gap: 14px; }
  .goodnight-band{ margin: 40px -18px 0; padding: 40px 18px 48px; }
  .goodnight-photo{ width: min(260px, 84%); }
}

/* ============================================================
   sticky share bar (mobile only)
   ============================================================ */
.share-bar{
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border-top: 2px solid var(--ink);
  padding: 10px 16px;
  display: none;
  justify-content: space-between;
  align-items: center;
  z-index: 30;
  margin: 24px -28px 0;
}
.share-bar .count{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}

/* ============================================================
   sponsors
   ============================================================ */
.sponsors{
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1.5px dashed rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.sponsors-label{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.sponsors-list{
  font-family: var(--hand);
  font-size: 22px;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.sponsor{
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: color .12s, border-color .12s;
}
.sponsor:hover{
  color: var(--wax);
  border-bottom-color: var(--wax);
}
.sponsors-sep{
  color: var(--ink-faint);
}

/* ============================================================
   footer
   ============================================================ */
.foot{
  margin-top: 32px;
  padding-top: 14px;
  border-top: 1.5px dashed rgba(0,0,0,.22);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-faint);
}
.foot a{ color: var(--ink-soft); text-decoration: none; }
.foot a:hover{ color: var(--ink); }

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 860px){
  .hero-card{ grid-template-columns: 120px 1fr; }
  .hero-pred{ grid-column: 1 / -1; }
  .entry-quote{ font-size: 32px; }
}

@media (max-width: 540px){
  .wrap{ padding: 0 18px 100px; }
  .title-strip{ padding: 10px 18px; margin: 0 -18px 18px; gap: 12px; }
  .diary-title{ font-size: 36px; }
  .ribbon{ font-size: 16px; padding: 3px 10px 5px; }
  .feed-me-btn{ font-size: 22px; padding: 5px 14px 8px; }
  .hero-card{ grid-template-columns: 100px 1fr; padding: 16px 14px; gap: 14px; }
  .hero-pet svg{ max-width: 100px; }
  .entry-quote{ font-size: 28px; }
  .entry{ grid-template-columns: 44px 1fr; gap: 12px; }
  .entry-face{ width: 44px; height: 44px; }
  .entry-text{ font-size: 22px; }
  .section-head h2{ font-size: 30px; }
  .share-bar{ display: flex; }
  .btn.share{ font-size: 20px; }
}

@media (prefers-reduced-motion: reduce){
  .btn{ transition: none; }
}
