/* =========================================================================
   Upcions Unlimited — design system
   An independent press: warm ink on paper, one clay accent, an organic
   line motif borrowed from the mark. Refined, editorial, unhurried.
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,400..600&family=Hanken+Grotesk:wght@400;500;600;700&display=swap");

:root {
  /* palette — warm near-blacks and creams, never pure #000 / #fff */
  --ink: #17140d;
  --ink-soft: #2a251c;
  --ink-2: #3a342a;
  --muted: #7a7264;
  --paper: #f4efe3;
  --paper-2: #ece4d4;
  --paper-3: #e2d8c4;
  --line: #d6cbb4;
  --clay: #b16a37;
  --clay-deep: #8f5026;
  --clay-tint: #e7c7a6;

  --max: 1240px;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --radius: 2px;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;

  --shadow-lift: 0 1px 0 rgba(23, 20, 13, 0.04),
    0 18px 40px -24px rgba(23, 20, 13, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* paper grain so backgrounds are never flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

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

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0;
  font-optical-sizing: auto;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--clay-deep);
  margin: 0;
}

/* ---- buttons ---------------------------------------------------------- */
.btn {
  --bg: var(--ink);
  --fg: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  padding: 0.85em 1.5em;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--bg);
  border-radius: 100px;
  cursor: pointer;
  transition: transform 0.4s var(--ease), background 0.3s var(--ease),
    color 0.3s var(--ease), box-shadow 0.4s var(--ease);
  will-change: transform;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -16px rgba(23, 20, 13, 0.6);
}
.btn:active {
  transform: translateY(0);
}
.btn--clay {
  --bg: var(--clay);
}
.btn--ghost {
  --bg: transparent;
  --fg: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn--block {
  width: 100%;
  justify-content: center;
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.btn svg {
  width: 1.05em;
  height: 1.05em;
}

/* ---- header ----------------------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.masthead__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--serif);
  font-size: 1.18rem;
  letter-spacing: -0.01em;
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}
.brand span b {
  font-weight: 600;
}
.brand span small {
  display: block;
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 1.9rem;
}
.nav a {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  position: relative;
  padding-block: 0.4rem;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav a:hover::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
}
.nav a[aria-current="page"] {
  color: var(--ink);
}

.cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  transition: border-color 0.3s, background 0.3s;
}
.cart-btn:hover {
  border-color: var(--ink);
}
.cart-btn .count {
  min-width: 1.4em;
  height: 1.4em;
  display: inline-grid;
  place-items: center;
  background: var(--clay);
  color: var(--paper);
  border-radius: 100px;
  font-size: 0.72rem;
  padding-inline: 0.35em;
}
.cart-btn .count[data-empty="true"] {
  background: var(--paper-3);
  color: var(--muted);
}

.menu-toggle {
  display: none;
}

/* ---- footer ----------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 6rem;
  background: var(--ink);
  color: var(--paper-2);
  padding-block: 4.5rem 2rem;
  overflow: hidden;
}
.site-footer .grain-strip {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  position: relative;
}
.site-footer h3 {
  color: var(--paper);
  font-size: 1.9rem;
  max-width: 16ch;
}
.site-footer .col h4 {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--clay-tint);
  margin-bottom: 1rem;
}
.site-footer .col a {
  display: block;
  color: var(--paper-2);
  opacity: 0.78;
  padding-block: 0.32rem;
  font-size: 0.92rem;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.site-footer .col a:hover {
  opacity: 1;
  transform: translateX(3px);
}
.footer-base {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(244, 239, 227, 0.16);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.78rem;
  color: rgba(244, 239, 227, 0.55);
  position: relative;
  flex-wrap: wrap;
}

/* ---- product card ----------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.card__cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  transition: transform 0.55s var(--ease), box-shadow 0.55s var(--ease);
}
.card__cover svg {
  width: 100%;
  height: 100%;
  display: block;
}
.card:hover .card__cover {
  transform: translateY(-6px) rotate(-0.5deg);
  box-shadow: 0 30px 50px -28px rgba(23, 20, 13, 0.6);
}
.tag {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 2;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.36em 0.7em;
  border-radius: 100px;
  backdrop-filter: blur(4px);
}
.tag--physical {
  background: var(--ink);
  color: var(--paper);
}
.card__meta {
  padding-top: 0.9rem;
}
.card__title {
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.12;
  margin: 0;
}
.card__author {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}
.card__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.6rem;
}
.price {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.kind {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clay-deep);
  font-weight: 600;
}

/* product grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: clamp(1.5rem, 3vw, 2.6rem) clamp(1.2rem, 2.4vw, 2rem);
}

/* skeleton loaders */
.sk {
  background: linear-gradient(
    100deg,
    var(--paper-2) 30%,
    var(--paper-3) 50%,
    var(--paper-2) 70%
  );
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius);
}
.sk--cover {
  aspect-ratio: 3 / 4;
}
.sk--line {
  height: 0.85rem;
  margin-top: 0.7rem;
}
.sk--line.short {
  width: 55%;
}
@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

/* section heading */
.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.4rem;
  flex-wrap: wrap;
}
.sec-head h2 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  max-width: 18ch;
}
.sec-head .link {
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--clay);
  padding-bottom: 2px;
  color: var(--clay-deep);
  white-space: nowrap;
}

/* reveal on scroll */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-reveal].in {
  opacity: 1;
  transform: none;
}

/* ---- cart drawer ------------------------------------------------------ */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(23, 20, 13, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s;
  z-index: 90;
  backdrop-filter: blur(2px);
}
.scrim.open {
  opacity: 1;
  visibility: visible;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(420px, 100%);
  background: var(--paper);
  z-index: 95;
  transform: translateX(100%);
  transition: transform 0.5s var(--ease);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}
.drawer.open {
  transform: none;
}
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem var(--gutter);
  border-bottom: 1px solid var(--line);
}
.drawer__head h3 {
  font-size: 1.5rem;
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  color: var(--ink);
  line-height: 0;
  border-radius: 50%;
  transition: background 0.25s;
}
.icon-btn:hover {
  background: var(--paper-3);
}
.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem var(--gutter);
}
.drawer__foot {
  border-top: 1px solid var(--line);
  padding: 1.4rem var(--gutter);
}
.line-item {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--paper-3);
  align-items: start;
}
.line-item__cover {
  width: 54px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
}
.line-item h4 {
  font-family: var(--serif);
  font-size: 1rem;
  margin: 0 0 0.2rem;
  line-height: 1.1;
}
.line-item .sub {
  font-size: 0.76rem;
  color: var(--muted);
}
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 100px;
  margin-top: 0.5rem;
}
.qty button {
  background: none;
  border: none;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.qty span {
  min-width: 1.6em;
  text-align: center;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.line-item__price {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
  margin-top: 0.4rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.remove:hover {
  color: var(--clay-deep);
}
.drawer-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}
.drawer-total .price {
  font-size: 1.6rem;
}
.empty-cart {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-cart svg {
  width: 46px;
  height: 46px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ---- forms ------------------------------------------------------------ */
.field {
  display: block;
  margin-bottom: 1.1rem;
}
.field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.45rem;
}
.field input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.field input:focus {
  outline: none;
  border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(177, 106, 55, 0.16);
}
.form-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
}
.form-error {
  color: var(--clay-deep);
  font-size: 0.85rem;
  margin-top: 0.6rem;
  min-height: 1.2em;
}

/* utilities */
.center {
  text-align: center;
}
.muted {
  color: var(--muted);
}
.hidden {
  display: none !important;
}

/* ---- responsive ------------------------------------------------------- */
@media (max-width: 820px) {
  .nav {
    position: fixed;
    inset: 74px 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 1rem var(--gutter) 1.5rem;
    transform: translateY(-130%);
    transition: transform 0.45s var(--ease);
    z-index: 40;
  }
  .nav.open {
    transform: none;
  }
  .nav a {
    width: 100%;
    padding-block: 0.8rem;
    border-bottom: 1px solid var(--paper-3);
    font-size: 1rem;
  }
  .menu-toggle {
    display: inline-grid;
    place-items: center;
    background: none;
    border: 1px solid var(--line);
    border-radius: 100px;
    width: 42px;
    height: 42px;
    cursor: pointer;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
