:root {
  color-scheme: light;
  --ink: #16120e;
  --ink-warm: #1b1408;
  --paper: #f3ede2;
  --paper-card: #faf6ee;
  --paper-sunk: #ede3d1;
  --paper-decaf: #ece6da;
  --line: rgba(22, 18, 14, 0.12);
  --muted: rgba(22, 18, 14, 0.5);
  --accent: #8a4b25;
  --good: #4f7a3e;
  --band-peak: #8fb87a;
  --decaf-stripe: repeating-linear-gradient(135deg, #16120e 0 5px, #4a3f33 5px 10px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Archivo, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.sheet-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

p,
h1,
h2 {
  margin: 0;
}

.coffee-page {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
}

.brand {
  color: var(--paper);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.kicker {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.label-header {
  position: relative;
  display: grid;
  min-height: 515px;
  align-content: end;
  gap: 16px;
  overflow: hidden;
  background: var(--jar-color);
  color: var(--paper);
  padding: 22px 22px 26px;
}

.decaf-page .label-header {
  background:
    linear-gradient(rgba(236, 230, 218, 0.9), rgba(236, 230, 218, 0.9)),
    var(--decaf-stripe);
  color: var(--ink);
}

.label-header::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(243, 237, 226, 0.28);
  border-radius: 16px;
  pointer-events: none;
}

.decaf-page .label-header::before {
  border-color: rgba(22, 18, 14, 0.14);
}

.label-top {
  position: absolute;
  top: 22px;
  right: 22px;
  left: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.decaf-page .brand {
  color: var(--ink);
}

.jar-disc {
  display: grid;
  place-items: center;
  width: 76px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.9rem;
  font-weight: 600;
}

.jar-number {
  position: relative;
  width: fit-content;
  color: rgba(243, 237, 226, 0.82);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  font-weight: 600;
  text-transform: uppercase;
}

.decaf-page .jar-number {
  color: rgba(22, 18, 14, 0.58);
}

.label-header h1 {
  position: relative;
  max-width: 9ch;
  font-size: 42px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: uppercase;
}

.origin-line {
  position: relative;
  color: rgba(243, 237, 226, 0.78);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}

.decaf-page .origin-line {
  color: rgba(22, 18, 14, 0.62);
}

.decaf-slug {
  position: absolute;
  top: 114px;
  right: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 10px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
}

.roast-scale {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 5px;
}

.roast-scale span {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.roast-scale i {
  display: block;
  height: 10px;
  border: 1px solid rgba(243, 237, 226, 0.22);
  border-radius: 999px;
  background: rgba(22, 18, 14, 0.22);
}

.decaf-page .roast-scale i {
  border-color: rgba(22, 18, 14, 0.14);
  background: rgba(22, 18, 14, 0.1);
}

.roast-scale .active i {
  background: var(--paper);
}

.decaf-page .roast-scale .active i {
  background: var(--ink);
}

.roast-scale b {
  min-height: 1rem;
  color: rgba(243, 237, 226, 0.82);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.decaf-page .roast-scale b {
  color: rgba(22, 18, 14, 0.7);
}

.freshness-section,
.notes-section,
.details-table,
.history-section {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.freshness-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.freshness-top p {
  color: var(--muted);
  font-weight: 600;
}

.freshness-top strong {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.4rem;
  font-weight: 600;
}

.freshness-track {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-sunk);
}

.peak-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 14%;
  width: 44%;
  background: var(--band-peak);
}

.freshness-marker {
  position: absolute;
  top: 50%;
  left: var(--marker);
  width: 22px;
  height: 22px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
}

.freshness-copy {
  color: var(--ink-warm);
  font-weight: 600;
  line-height: 1.42;
}

.readiness-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.readiness-grid span,
.recipe-chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-card);
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.verdict-panel {
  display: grid;
  gap: 11px;
  margin: 16px 14px;
  border: 1px solid rgba(138, 75, 37, 0.18);
  border-radius: 4px;
  background:
    radial-gradient(circle at 12% 8%, rgba(201, 138, 46, 0.25), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(79, 122, 62, 0.18), transparent 32%),
    #fbf4e8;
  padding: 20px;
}

.verdict-panel h2 {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.02;
}

.verdict-panel p:not(.kicker) {
  color: rgba(22, 18, 14, 0.72);
  font-weight: 600;
  line-height: 1.43;
}

.recipe-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.notes-section {
  gap: 10px;
}

.note-list {
  display: grid;
  gap: 12px;
}

.note-list p {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.55rem;
  font-style: italic;
  line-height: 1.16;
}

.note-source {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.details-table {
  gap: 0;
  padding-block: 8px;
}

.details-table > div,
.details-table details {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.details-table > div:last-child {
  border-bottom: 0;
}

.details-table div,
.details-table summary {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: baseline;
}

.details-table span {
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.details-table strong,
.details-table a {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.3;
}

.details-table a {
  color: var(--accent);
}

.details-table summary {
  cursor: pointer;
  list-style: none;
}

.details-table summary::-webkit-details-marker {
  display: none;
}

.details-table details p {
  margin: 10px 0 0 106px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.history-section {
  padding-bottom: 112px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading a {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
}

.history-empty {
  color: var(--muted);
  font-weight: 600;
}

.history-row {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.history-row div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.history-row strong {
  font-weight: 800;
}

.history-row span,
.history-row p {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.log-cta {
  position: fixed;
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: 16px;
  left: max(16px, calc((100vw - 480px) / 2 + 16px));
  z-index: 10;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(22, 18, 14, 0.24);
}

.log-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: rgba(22, 18, 14, 0.32);
}

.sheet-panel {
  width: min(100%, 480px);
  max-height: 88vh;
  margin: 0 auto;
  overflow: auto;
  border-radius: 16px 16px 0 0;
  background: var(--paper-card);
  padding: 16px;
  box-shadow: 0 -22px 60px rgba(22, 18, 14, 0.24);
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.method-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-sunk);
  padding: 4px;
}

.method-tabs button,
.icon-close,
.save-shot,
.undo-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
}

.method-tabs button {
  background: transparent;
  color: var(--muted);
}

.method-tabs button.active {
  background: var(--ink);
  color: var(--paper);
}

.icon-close {
  width: 44px;
  background: var(--paper-sunk);
  color: var(--ink);
}

.espresso-log,
.pour-log {
  display: grid;
  gap: 12px;
}

.ratio-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 16px;
}

.ratio-card span {
  color: rgba(243, 237, 226, 0.66);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.ratio-card strong {
  font-size: 1.8rem;
  line-height: 1;
}

.stepper-row {
  display: grid;
  grid-template-columns: 1fr 44px 76px 44px;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}

.stepper-row span,
.compact-field {
  color: rgba(22, 18, 14, 0.72);
  font-weight: 800;
}

.stepper-row button {
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 800;
}

.stepper-row input,
.compact-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.repeat-toggle,
.rating-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: rgba(22, 18, 14, 0.72);
  font-weight: 800;
}

.save-shot {
  background: var(--ink);
  color: var(--paper);
}

.pour-button {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 226px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--jar-color);
  color: var(--paper);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
}

.pour-button.logged {
  background: var(--good);
}

.undo-button {
  background: var(--paper-sunk);
  color: var(--ink);
}

.compact-field {
  display: grid;
  gap: 8px;
}

.rating-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rating-row label {
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.shelf-page {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.shelf-header {
  display: grid;
  min-height: 190px;
  align-content: end;
  gap: 12px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--paper);
  padding: 18px;
}

.shelf-header h1 {
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
}

.shelf-list {
  display: grid;
  gap: 10px;
}

.shelf-tile {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  padding: 12px;
  color: inherit;
  text-decoration: none;
}

.shelf-chip {
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--jar-color);
  color: var(--paper);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}

.decaf-tile .shelf-chip {
  background: var(--decaf-stripe);
}

.shelf-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.shelf-copy strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.08;
  text-transform: uppercase;
}

.shelf-copy small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
}

.decaf-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.decaf-divider::before,
.decaf-divider::after {
  content: "";
  height: 8px;
  background: var(--decaf-stripe);
}

.empty-tile {
  border-style: dashed;
}

.empty-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 22px;
  text-align: center;
}

.empty-page .mini-lockup {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.empty-page h1 {
  font-size: 2rem;
  text-transform: uppercase;
}

.empty-page p {
  max-width: 28ch;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

@media (min-width: 860px) {
  .coffee-page {
    width: min(100%, 1120px);
  }

  .jar-page {
    display: grid;
    grid-template-columns: minmax(420px, 0.92fr) minmax(360px, 1fr);
    min-height: 100vh;
  }

  .label-header {
    position: sticky;
    top: 0;
    min-height: 100vh;
  }

  .freshness-section,
  .notes-section,
  .details-table,
  .history-section {
    grid-column: 2;
  }

  .verdict-panel {
    grid-column: 2;
    margin: 18px 22px;
  }

  .log-cta {
    right: calc((100vw - min(100vw, 1120px)) / 2 + 22px);
    left: auto;
    width: 340px;
  }

  .shelf-page {
    width: min(100%, 840px);
    margin: 0 auto;
  }
}

@media (max-width: 360px) {
  .label-header h1 {
    font-size: 36px;
  }

  .recipe-chips,
  .readiness-grid,
  .rating-row {
    grid-template-columns: 1fr;
  }

  .stepper-row {
    grid-template-columns: 1fr 44px 64px 44px;
  }
}
