@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Playfair+Display:ital,wght@0,600;1,600&display=swap');

:root {
  --ink: #24352b;
  --forest: #294936;
  --forest-hover: #203d2c;
  --paper: #fbf9f2;
  --surface: #fffdf8;
  --cream: #f1ecdf;
  --line: #d9d4c8;
  --line-strong: #c7c0b1;
  --gold: #a8752b;
  --muted: #69746c;
  --danger: #985542;
  --container: 1200px;
  --page-pad: clamp(20px, 4vw, 48px);
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.5 'DM Sans', sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* Shared alignment container */
.hero-inner,
main {
  width: min(100%, var(--container));
  margin-inline: auto;
}

/* Hero */
.hero {
  position: relative;
  min-height: 352px;
  overflow: hidden;
  color: #f5f0e5;
  background:
    radial-gradient(circle at 78% 48%, #60745f 0, transparent 25%),
    linear-gradient(120deg, #1c3528, #395744);
}
.hero::after {
  position: absolute;
  inset: 0;
  content: '';
  opacity: .08;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.7' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.hero-inner {
  position: relative;
  min-height: inherit;
  padding: 28px var(--page-pad) 72px;
}
.brand,
.hero-copy,
.kettle { position: relative; z-index: 1; }
.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: max-content;
}
.brand strong,
.brand small { display: block; letter-spacing: .2em; }
.brand strong { font-size: 13px; line-height: 1.1; }
.brand small { margin-top: var(--s1); font-size: 8px; opacity: .7; }
.mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid rgb(220 230 218 / 55%);
  font-size: 17px;
}
.hero-copy { margin: 54px 0 0 clamp(0px, 4vw, 48px); }
.eyebrow {
  margin: 0 0 var(--s2);
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  line-height: 1.4;
}
.hero h1 {
  max-width: 650px;
  margin: 0;
  font: 600 clamp(44px, 5.2vw, 68px)/.98 'Playfair Display', serif;
  letter-spacing: -.035em;
}
.hero h1 em { color: #c7b585; }
.hero-copy > p:last-child {
  max-width: 390px;
  margin: var(--s4) 0 0;
  color: #d4dbd3;
  line-height: 1.7;
}
.kettle {
  position: absolute;
  top: 132px;
  right: clamp(60px, 12vw, 164px);
  color: #b9c1b5;
  font-size: clamp(80px, 9vw, 120px);
  line-height: 1;
  opacity: .22;
}

/* Summary */
main { padding-inline: var(--page-pad); }
.summary {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(220px, 1.35fr);
  min-height: 96px;
  margin-top: -28px;
  padding: var(--s4) var(--s5);
  align-items: stretch;
  border: 1px solid var(--line);
  background: #f7f3e9;
  box-shadow: 0 12px 30px rgb(27 45 34 / 8%);
}
.summary-stat {
  display: flex;
  min-width: 0;
  padding: 0 var(--s5);
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}
.summary-stat:first-child { padding-left: 0; }
.summary b {
  display: block;
  margin-bottom: 2px;
  font: 600 29px/1.1 'Playfair Display', serif;
  font-variant-numeric: tabular-nums;
}
.summary span,
.section-head > span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .14em;
  line-height: 1.4;
}
.summary .primary {
  width: min(100%, 230px);
  align-self: center;
  justify-self: end;
}

/* Buttons and fields */
button {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
button > i { margin-right: 7px; }
.icon-btn > i,
.close > i { margin-right: 0; }
.primary {
  padding: 13px 20px;
  background: var(--forest);
  color: #fff;
}
.primary:hover { background: var(--forest-hover); }
.secondary {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--forest);
  background: transparent;
  color: var(--forest);
}
.secondary:hover { background: rgb(41 73 54 / 7%); }
input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: var(--s2);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
}
input,
select { height: 44px; padding: 0 var(--s3); }
textarea { min-height: 88px; padding: 11px var(--s3); line-height: 1.5; resize: vertical; }
input::placeholder,
textarea::placeholder { color: #90978f; }
input:hover,
select:hover,
textarea:hover { border-color: var(--line-strong); }

/* Main workspace */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(300px, .9fr);
  gap: clamp(32px, 4vw, 56px);
  padding-block: 56px 72px;
  align-items: start;
}
.collection { min-width: 0; }
.section-head {
  display: flex;
  min-height: 58px;
  margin-bottom: var(--s5);
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s4);
}
.section-head h2,
dialog h2 {
  margin: 0;
  font: 600 32px/1.12 'Playfair Display', serif;
  letter-spacing: -.02em;
}
.section-head > span {
  padding-bottom: 5px;
  flex: 0 0 auto;
}
.filters {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 148px 148px;
  gap: var(--s3);
  margin-bottom: var(--s5);
  align-items: end;
}
.filters label,
.wishlist form label,
dialog form > label,
.two label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.4;
}
.search { position: relative; }
.search span {
  position: absolute;
  z-index: 1;
  bottom: 10px;
  left: var(--s3);
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  pointer-events: none;
}
.search input { padding-left: 38px; }

/* Tried tea list */
.tea-list {
  max-height: 560px;
  overflow-y: auto;
  padding-right: var(--s2);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}
.tea-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(88px, auto);
  gap: var(--s4);
  min-height: 88px;
  padding: var(--s4) var(--s2);
  align-items: center;
  border-top: 1px solid var(--line);
}
.tea-card:last-child { border-bottom: 1px solid var(--line); }
.tea-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: #e5eadf;
  font-size: 21px;
}
.tea-card h3,
.wish-item h3 {
  margin: 0 0 var(--s1);
  font: 600 18px/1.25 'Playfair Display', serif;
  overflow-wrap: anywhere;
}
.meta {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  line-height: 1.4;
  text-transform: uppercase;
}
.note {
  margin: var(--s2) 0 0;
  color: #5d665e;
  font-style: italic;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.rating {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s1);
  align-items: center;
  justify-items: end;
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
}
.rating-stars {
  display: inline-flex;
  gap: 3px;
  font-size: 12px;
}
.icon-btn {
  display: inline-grid;
  width: 36px;
  min-height: 36px;
  padding: 0;
  place-items: center;
  background: transparent;
  color: var(--danger);
  font-size: 20px;
  letter-spacing: 0;
}
.icon-btn:hover { background: rgb(152 85 66 / 8%); }
.empty {
  min-height: 184px;
  padding: 48px var(--s5);
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}
.empty b {
  display: block;
  margin-bottom: var(--s2);
  color: var(--ink);
  font: 600 20px/1.25 'Playfair Display', serif;
}

/* Wish list */
.wishlist {
  min-width: 0;
  padding: 28px;
  border-top: 4px solid var(--forest);
  background: var(--cream);
}
.wishlist .section-head { margin-bottom: var(--s5); }
.wishlist form {
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}
.wishlist form label {
  display: block;
  margin-bottom: var(--s4);
}
.wishlist small,
dialog small { float: right; color: #858d85; }
.wish-list { margin-top: 0; }
.wish-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s3);
  min-height: 78px;
  padding: var(--s4) 0;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.wish-item p {
  margin: var(--s1) 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.wish-item > div:last-child {
  display: flex;
  align-items: center;
  gap: var(--s1);
}
.wish-item button.move {
  min-height: 36px;
  padding: 0 var(--s2);
  background: transparent;
  color: var(--forest);
  font-size: 10px;
  letter-spacing: .05em;
  white-space: nowrap;
}
.wish-item button.move i { margin: 0 0 0 4px; }
.wish-item button.move:hover { background: rgb(41 73 54 / 7%); }
.wishlist .empty {
  min-height: 150px;
  margin-top: var(--s5);
  padding-block: var(--s6);
}

/* Tea form dialog */
dialog {
  width: min(570px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow-y: auto;
  border: 0;
  background: var(--paper);
  box-shadow: 0 24px 70px rgb(20 37 27 / 38%);
}
dialog::backdrop {
  background: rgb(20 37 27 / 78%);
  backdrop-filter: blur(3px);
}
dialog form { position: relative; padding: 38px; }
dialog .intro { margin: var(--s2) 0 var(--s5); color: var(--muted); }
.close {
  position: absolute;
  top: var(--s4);
  right: var(--s4);
  display: grid;
  width: 40px;
  min-height: 40px;
  padding: 0;
  place-items: center;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 0;
}
.close:hover { background: rgb(36 53 43 / 6%); }
dialog form > label { display: block; margin: var(--s4) 0 0; }
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
  margin-top: var(--s4);
}
fieldset { margin: var(--s5) 0 0; padding: 0; border: 0; }
legend {
  margin-bottom: var(--s2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
}
.stars {
  display: flex;
  width: max-content;
  flex-direction: row-reverse;
  justify-content: flex-end;
}
.stars input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.stars label {
  padding-right: 3px;
  color: #d4d0c5;
  font-size: 30px;
  line-height: 1.2;
  cursor: pointer;
}
.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label { color: var(--gold); }
.stars input:focus-visible + label { outline: 3px solid #c99c53; outline-offset: 2px; }
dialog .primary { width: 100%; margin-top: var(--s3); }
.form-error {
  min-height: 18px;
  margin: var(--s2) 0 0;
  color: var(--danger);
  font-size: 12px;
  letter-spacing: 0;
  line-height: 1.5;
}
.form-error:empty { visibility: hidden; }

/* Feedback and accessibility */
#toast {
  position: fixed;
  z-index: 5;
  bottom: var(--s5);
  left: 50%;
  max-width: calc(100% - 32px);
  padding: var(--s3) var(--s4);
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
:focus-visible { outline: 3px solid #c99c53; outline-offset: 2px; }

/* Tablet */
@media (max-width: 960px) {
  .hero-copy { margin-left: 0; }
  .summary {
    grid-template-columns: repeat(3, 1fr);
    row-gap: var(--s4);
  }
  .summary .primary {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--s6);
  }
  .filters { grid-template-columns: 1fr 132px 132px; }
  .wishlist { padding: var(--s5); }
}

/* Stacked content */
@media (max-width: 760px) {
  :root { --page-pad: 20px; }
  .hero { min-height: 320px; }
  .hero-inner { padding-top: var(--s5); padding-bottom: var(--s8); }
  .hero-copy { margin-top: var(--s7); }
  .hero h1 { font-size: clamp(42px, 11vw, 56px); }
  .kettle { right: 36px; opacity: .12; }
  .workspace {
    grid-template-columns: 1fr;
    gap: var(--s7);
    padding-block: var(--s7) var(--s8);
  }
  .wishlist { width: 100%; }
}

/* Mobile */
@media (max-width: 560px) {
  :root { --page-pad: 16px; }
  .hero { min-height: 304px; }
  .hero-inner { padding-top: 20px; padding-bottom: 56px; }
  .brand small { display: none; }
  .hero-copy { margin-top: 44px; }
  .hero-copy > p:last-child br { display: none; }
  .kettle { display: none; }
  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 0;
    margin-top: -24px;
    padding: var(--s4) var(--s2);
  }
  .summary-stat { padding: 0 var(--s2); text-align: center; }
  .summary-stat:first-child { padding-left: var(--s2); }
  .summary b { font-size: 24px; }
  .summary span { font-size: 8px; letter-spacing: .1em; }
  .summary .primary { margin-top: 0; }
  .workspace { padding-top: 40px; }
  .section-head { min-height: 52px; margin-bottom: 20px; }
  .section-head h2, dialog h2 { font-size: 29px; }
  .filters { grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .search { grid-column: 1 / -1; }
  .tea-list { max-height: 500px; padding-right: 0; }
  .tea-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: var(--s3);
    padding: var(--s4) var(--s1);
  }
  .tea-icon { width: 42px; height: 42px; }
  .rating {
    grid-column: 2;
    width: 100%;
    margin-top: -4px;
    justify-items: start;
  }
  .rating .icon-btn { justify-self: end; }
  .wishlist { padding: var(--s5) 20px; }
  dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  dialog form { padding: 30px 20px 24px; }
  .two { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 40px; }
  .summary { padding-inline: var(--s1); }
  .summary-stat { padding-inline: var(--s1); }
  .summary b { font-size: 21px; }
  .filters { grid-template-columns: 1fr; }
  .search { grid-column: auto; }
  .wish-item { grid-template-columns: 1fr; }
  .wish-item > div:last-child { justify-content: space-between; }
}

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