
/* ==========================================
   CUPORA - COMPLETE STYLESHEET
   ========================================== */


/* ==========================================
   1. CSS VARIABLES & COLOR SCHEMES
   ========================================== */

:root {
  --bg: #FAF6F0;
  --panel: #FFFDF9;
  --ink: #22252A;
  --mute: #5E5B55;
  --line: #E5DDD0;
  --orange: #F48C56;
  --amber: #E8A85A;
  --sage: #6B8E78;
  --terracotta: #D96B52;
  --sand: #C99368;
  --peach: #F2A679;

  --shadow: 0 18px 50px rgba(34, 37, 42, .07);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191816;
    --panel: #24221F;
    --ink: #FAF6F0;
    --mute: #A8A298;
    --line: #38342E;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  }
}


/* ==========================================
   2. GLOBAL BASE STYLES
   ========================================== */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;

  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(244, 140, 86, .13),
      transparent 42%
    ),
    var(--bg);

  color: var(--ink);

  font: 500 17px/1.55
    ui-rounded,
    "SF Pro Rounded",
    Nunito,
    "Segoe UI Variable",
    system-ui,
    sans-serif;

  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}

main {
  padding-bottom: 18px;
}


/* ==========================================
   3. HEADER & BRANDING
   ========================================== */

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 0 10px;
}

.mark {
  display: grid;
  grid-template-columns: repeat(2, 13px);
  gap: 3px;
}

.mark i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.mark i:nth-child(1) {
  background: var(--orange);
}

.mark i:nth-child(2) {
  background: var(--sage);
}

.mark i:nth-child(3) {
  background: var(--amber);
}

.mark i:nth-child(4) {
  background: var(--terracotta);
}

.brand {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -.04em;
}

h1 {
  font-size: clamp(32px, 8.5vw, 58px);
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 800;
  margin: 22px 0 10px;
  max-width: 15ch;
}

.lede {
  color: var(--mute);
  margin: 0 0 22px;
  max-width: 46ch;
}


/* ==========================================
   4. MAIN CONVERTER PANEL
   ========================================== */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 18px;

  display: grid;
  gap: 25px;

  /* Mobile layout */
  grid-template-areas:
    "c"
    "a"
    "r"
    "copy"
    "o";

  box-shadow: var(--shadow);
}

.a-chips {
  grid-area: c;
  min-width: 0;
}

.a-amt {
  grid-area: a;
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.a-res {
  grid-area: r;
  min-width: 0;
  align-self: start;
}

.a-opt {
  grid-area: o;
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

.a-copy {
  grid-area: copy;
  width: 100%;
  min-width: 0;
  align-self: start;
}


/* ==========================================
   5. STEP HEADINGS
   ========================================== */

.step-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;

  flex: 0 0 39px;
  height: 39px;

  border-radius: 12px;
  background: rgba(244, 140, 86, .15);

  color: var(--terracotta);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .03em;
}

.step-title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.step-description {
  display: block;
  color: var(--mute);
  font-size: 13px;
  font-weight: 500;
  margin-top: 3px;
  line-height: 1.4;
}


/* ==========================================
   6. INGREDIENT PICKER
   ========================================== */

.ingredient-picker {
  display: grid;
  gap: 17px;
}

.picker-block {
  min-width: 0;
}

.picker-label,
.selection-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--mute);
  margin-bottom: 10px;
}

.picker-divider {
  display: flex;
  align-items: center;
  gap: 12px;

  color: var(--mute);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
}

.picker-divider span:first-child,
.picker-divider span:last-child {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.selection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-bottom: 9px;
}

.selection-label {
  margin: 0;
}

.selection-help {
  font-size: 12px;
  color: var(--mute);
}


/* Ingredient category cards */

.ingredient-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.ingredient-category {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;

  gap: 5px;
  min-width: 0;
  min-height: 112px;

  padding: 13px 10px;

  border: 1.5px solid transparent;
  border-radius: 16px;

  color: var(--ink);
  font: inherit;
  cursor: pointer;

  transition:
    border-color .18s ease,
    transform .18s ease,
    box-shadow .18s ease;
}

.ingredient-category:hover {
  transform: translateY(-2px);
  filter: none;
}

.ingredient-category:active {
  transform: translateY(1px);
}

.ingredient-category[aria-pressed="true"] {
  border-color: currentColor;
  box-shadow: inset 0 0 0 1px currentColor;
}

.ingredient-category .category-icon {
  font-size: 23px;
  line-height: 1.2;
}

.ingredient-category .category-name {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.ingredient-category .category-description {
  font-size: 10px;
  line-height: 1.35;
  opacity: .8;
  font-weight: 600;
}


/* Category colours */

.cat-flours {
  background: rgba(244, 140, 86, .15);
  color: var(--terracotta);
  border-color: rgba(244, 140, 86, .25);
}

.cat-sweeteners {
  background: rgba(232, 168, 90, .17);
  color: #A87532;
  border-color: rgba(232, 168, 90, .3);
}

.cat-fats {
  background: rgba(107, 142, 120, .15);
  color: var(--sage);
  border-color: rgba(107, 142, 120, .25);
}

.cat-liquids {
  background: rgba(217, 107, 82, .13);
  color: var(--terracotta);
  border-color: rgba(217, 107, 82, .25);
}

.cat-pantry {
  background: rgba(244, 140, 86, .11);
  color: var(--sand);
  border-color: rgba(201, 147, 104, .3);
}


/* Ingredient selection buttons */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;

  padding: 2px 2px 8px;
  margin: 0 -18px;
  padding-inline: 18px;

  scrollbar-width: thin;
}

.chip,
.seg button {
  font: inherit;
  font-weight: 700;

  border: 2px solid var(--line);
  background: transparent;
  color: var(--ink);

  border-radius: 999px;
  padding: 10px 16px;
  min-height: 46px;

  cursor: pointer;
  white-space: nowrap;
  scroll-snap-align: start;
  touch-action: manipulation;

  transition:
    background .15s,
    border-color .15s;
}

.chip[aria-pressed="true"],
.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.ingredient-options.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  overflow: visible;
  margin: 0;
  padding: 0;
}

.ingredient-options .chip {
  min-height: 42px;
  padding: 9px 14px;
  font-size: 13px;
  border-width: 1.5px;
}

.ingredient-options .chip[aria-pressed="true"] {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}


/* ==========================================
   7. CONVERSION INPUT AREA
   ========================================== */

.conversion-input-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 17px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--mute);
  margin-bottom: 9px;
}

label,
.lab {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 8px;
}

.direction-segment {
  gap: 7px;
}

.direction-segment button {
  font-size: 12px;
  padding: 9px 12px;
  min-height: 43px;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.conversion-input-box > label {
  font-size: 14px;
  margin-bottom: 8px;
}

.input-divider {
  height: 1px;
  background: var(--line);
  margin: 17px 0;
}

.amt {
  display: flex;
  gap: 10px;
  align-items: center;
}

input,
select {
  font: inherit;
  font-weight: 700;

  color: var(--ink);
  background: var(--bg);

  border: 2px solid var(--line);
  border-radius: 18px;

  min-height: 60px;
  padding: 0 16px;

  width: 100%;
  min-width: 0;
}

input {
  font-size: 28px;
  letter-spacing: -.02em;
}

select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;

  padding-right: 38px;

  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);

  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;

  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.amt select {
  max-width: 170px;
}

.custom-cup-box {
  margin-top: 13px;
  background: var(--bg);
  border: 1.5px dashed var(--line);
  padding: 13px;
  border-radius: 14px;
}

.custom-cup-box label {
  font-size: 13px;
  color: var(--mute);
  margin-bottom: 6px;
}

.custom-cup-box .amt input {
  min-height: 48px;
  font-size: 20px;
}

.unit-badge {
  font-weight: 700;
  color: var(--mute);
  padding-right: 8px;
}

.conversion-input-box .note {
  margin-top: 9px;
  font-size: 13px;
}

.note {
  color: var(--mute);
  font-size: 15px;
  margin: 0;
  line-height: 1.45;
}


/* ==========================================
   8. RESULT PANEL
   ========================================== */

.result {
  position: relative;

  display: flex;
  flex-direction: column;

  min-width: 0;
  min-height: 0;
  height: auto;

  padding: 22px;

  background: var(--orange);
  color: #22252A;

  border-radius: 24px;

  box-shadow: 0 12px 30px rgba(244, 140, 86, .19);
}

.result-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 23px;
}

.result-heading {
  display: flex;
  align-items: center;
  gap: 9px;

  font-size: 15px;
  font-weight: 800;
}

.result-check {
  display: flex;
  justify-content: center;
  align-items: center;

  width: 25px;
  height: 25px;

  border-radius: 50%;
  background: rgba(34, 37, 42, .12);

  font-size: 13px;
}

.result-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .09em;
  opacity: .65;
}

.result .resbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.result .resbar .lab {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.result .resbar select {
  width: auto;
  min-width: 100px;
  max-width: 150px;

  min-height: 43px;
  border-radius: 12px;

  background-color: rgba(255, 253, 249, .65);
  border-color: rgba(34, 37, 42, .25);
  color: #22252A;

  font-size: 16px;

  background-image:
    linear-gradient(45deg, transparent 50%, #22252A 50%),
    linear-gradient(135deg, #22252A 50%, transparent 50%);
}

.result .swap {
  flex: none;
  margin-left: auto;

  min-height: 43px;
  padding: 0 12px;

  border-radius: 12px;
  border: 2px solid #22252A;

  background: transparent;
  color: #22252A;

  font: inherit;
  font-weight: 700;
  font-size: 13px;

  cursor: pointer;
}

.result output {
  display: block;

  font-size: clamp(48px, 10vw, 82px);
  line-height: 1.05;

  font-weight: 850;
  letter-spacing: -.055em;

  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;

  margin: 9px 0;
}

.result .hint {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 600;
  margin: 5px 0 18px;
  min-height: 1.5em;
}

.result-footnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;

  border-top: 1px solid rgba(34, 37, 42, .2);
  padding-top: 13px;
  margin-top: 8px;

  font-size: 11px;
  line-height: 1.45;
  font-weight: 600;
  opacity: .75;
}


/* ==========================================
   9. COPY LINK BUTTON
   ========================================== */

.copy {
  display: block;

  width: 100%;
  min-height: 54px;

  padding: 12px 18px;

  border: 1.5px solid var(--ink);
  border-radius: 14px;

  background: transparent;
  color: var(--ink);

  font: inherit;
  font-size: 14px;
  font-weight: 800;

  cursor: pointer;
  touch-action: manipulation;

  transition:
    background .15s ease,
    color .15s ease,
    border-color .15s ease;
}

/* Independent button directly below the result panel */

.a-copy {
  grid-area: copy;
  width: 100%;
  margin: 0;
  justify-self: stretch;
  align-self: start;
}

.a-copy:hover {
  background: var(--ink);
  color: var(--bg);
}


/* ==========================================
   10. MEASUREMENT SETTINGS
   ========================================== */

.settings-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 17px;
}

.setting-group .lab {
  font-size: 14px;
  margin-bottom: 11px;
}

.settings-box .seg button {
  font-size: 13px;
  padding: 9px 13px;
  min-height: 43px;
}

.settings-box .note {
  margin-top: 10px;
  font-size: 13px;
}


/* ==========================================
   11. GENERAL BUTTON INTERACTIONS
   ========================================== */

button:hover {
  filter: brightness(.97);
}

button:active {
  transform: translateY(1px);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}


/* ==========================================
   12. CONTENT SECTIONS, TABLES & CARDS
   ========================================== */

.content-section {
  margin-top: 44px;
}

.content-section h2 {
  margin-top: 0;
}

.content-section p {
  max-width: 72ch;
  color: var(--mute);
}

h2 {
  font-size: clamp(24px, 5.5vw, 34px);
  letter-spacing: -.03em;
  line-height: 1.1;
  margin: 44px 0 12px;
}

.conversion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.conversion-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  min-width: 0;
}

.conversion-card strong {
  display: block;
  font-size: 18px;
  letter-spacing: -.02em;
}

.conversion-card span {
  display: block;
  color: var(--mute);
  font-size: 14px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-variant-numeric: tabular-nums;
}

th {
  text-align: left;
  font-size: 14px;
  color: var(--mute);
  font-weight: 700;
  padding: 0 14px;
}

td {
  background: var(--panel);
  padding: 12px 14px;
  font-weight: 700;
}

td:first-child {
  border-radius: 14px 0 0 14px;
  border-left: 10px solid var(--orange);
  font-size: 20px;
}

td:last-child {
  border-radius: 0 14px 14px 0;
}

.tw {
  overflow-x: auto;
}

details {
  border-top: 2px solid var(--line);
  padding: 14px 0;
}

details:last-of-type {
  border-bottom: 2px solid var(--line);
}

summary {
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
}

details p {
  margin: 10px 0 0;
  color: var(--mute);
  max-width: 62ch;
}

.faq-intro {
  margin: 0 0 12px;
  color: var(--mute);
}


/* ==========================================
   13. FOOTER & ACCESSIBILITY
   ========================================== */

footer {
  margin: 40px 0 28px;
  color: var(--mute);
  font-size: 14px;

  border-top: 1px solid var(--line);
  padding-top: 18px;

  line-height: 1.6;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;

  background: var(--ink);
  color: var(--bg);

  padding: 12px 16px;
  border-radius: 12px;
}

.skip-link:focus {
  top: 12px;
}


/* ==========================================
   14. DARK MODE ADJUSTMENTS
   ========================================== */

@media (prefers-color-scheme: dark) {

  .ingredient-options .chip[aria-pressed="true"] {
    background: var(--sage);
    border-color: var(--sage);
    color: #fff;
  }

  .step-number {
    background: rgba(244, 140, 86, .17);
    color: var(--orange);
  }

  .result {
    color: #22252A;
  }

  .result .hint,
  .result-heading,
  .result .lab {
    color: #22252A;
  }

}


/* ==========================================
   15. DESKTOP LAYOUT
   ========================================== */

@media (min-width: 780px) {

  .wrap {
    max-width: 1200px;
  }

  .panel {
    grid-template-columns:
      minmax(0, 1.05fr)
      minmax(0, 1fr);

    grid-template-areas:
      "c c"
      "a r"
      "o copy";

    gap: 30px 34px;
    padding: 30px;
  }

  .chips {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .ingredient-categories {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  /* Result stays compact instead of stretching */
  .a-res {
    position: static;
    align-self: start;
  }

  .result {
    min-height: 0;
    height: auto;
  }

  .a-copy {
    align-self: start;
  }

  .conversion-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

}


/* ==========================================
   16. TABLET LAYOUT
   ========================================== */

@media (max-width: 779px) {

  .ingredient-categories {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result {
    min-height: 0;
  }

}


/* ==========================================
   17. MOBILE LAYOUT
   ========================================== */

@media (max-width: 520px) {

  body {
    font-size: 16px;
  }

  .wrap {
    padding-inline: 14px;
  }

  header {
    padding-top: 16px;
  }

  h1 {
    font-size: clamp(34px, 10vw, 46px);
    margin-top: 20px;
  }

  .lede {
    font-size: 16px;
  }

  .panel {
    padding: 14px;
    border-radius: 22px;
    gap: 17px;

    grid-template-areas:
      "c"
      "a"
      "r"
      "copy"
      "o";
  }

  .chips {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .step-heading {
    gap: 10px;
  }

  .step-number {
    flex-basis: 35px;
    height: 35px;
    border-radius: 11px;
  }

  .step-title {
    font-size: 16px;
  }

  .step-description {
    font-size: 12px;
  }

  .ingredient-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ingredient-category {
    min-height: 100px;
    padding: 11px;
  }

  .ingredient-category .category-name {
    font-size: 12px;
  }

  .ingredient-category .category-description {
    font-size: 10px;
  }

  .ingredient-options.chips {
    margin: 0;
    padding: 2px 0 0;
  }

  .conversion-input-box,
  .settings-box {
    padding: 14px;
  }

  .direction-segment button {
    flex: 1 1 auto;
  }

  .amt {
    gap: 8px;
  }

  .amt select {
    max-width: 124px;
    padding-left: 10px;
    padding-right: 30px;
  }

  input {
    font-size: 24px;
    padding-inline: 12px;
    min-height: 58px;
  }

  .result {
    padding: 18px;
    border-radius: 20px;
  }

  .result-topline {
    margin-bottom: 17px;
  }

  .result-label {
    font-size: 8px;
  }

  .result output {
    font-size: clamp(46px, 13vw, 65px);
  }

  .result .resbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .result .resbar select {
    max-width: 120px;
    min-height: 44px;
  }

  .result .swap {
    margin-left: auto;
    padding-inline: 12px;
    font-size: 14px;
  }

  .a-copy {
    min-height: 50px;
  }

  h2 {
    margin-top: 36px;
  }

  .conversion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .conversion-card {
    padding: 12px;
  }

  .conversion-card strong {
    font-size: 16px;
  }

  .tw {
    margin-inline: -2px;
  }

  td {
    padding: 11px 10px;
  }

  td:first-child {
    font-size: 17px;
    border-left-width: 6px;
  }

  .picker-divider {
    font-size: 9px;
  }

}


/* ==========================================
   18. SMALL MOBILE SCREENS
   ========================================== */

@media (max-width: 360px) {

  .selection-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .result .resbar {
    align-items: center;
  }

  .result .swap {
    margin-left: 0;
  }

  .conversion-grid {
    grid-template-columns: 1fr;
  }

}


/* ==========================================
   19. REDUCED MOTION ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }

}

/* ==========================================
   END OF CUPORA STYLESHEET
   ========================================== */
