/* ==========================================================================
   NUN' 2 IT
   Contents: 1 Fonts  2 Colors and sizes  3 Basics  4 Type  5 Buttons
             6 Header and footer  7 Hero  8 Sections  9 Products
             10 Product page  11 Cart  12 Text pages  13 Motion
   ========================================================================== */

/* 1. Fonts ================================================================= */

@font-face {
  font-family: "Anton";
  src: url("/fonts/anton.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Libre Caslon Text";
  src: url("/fonts/libre-caslon-text.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("/fonts/work-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* 2. Colors and sizes ====================================================== */

/*
  Safe text colors (AA contrast is 4.5 or higher):
    ink on cream 14.7     ink on clay 5.9      ink on orange 6.7
    cream on ink 14.7     cream on rust 6.7
  Don't put cream text on clay. It's only 2.5. (The logo is OK.)
*/
:root {
  --cream: #f2e8d5;
  --paper: #fbf6ec;       /* lighter cream for cards */
  --clay: #d27f66;        /* signature terracotta */
  --rust: #7b3f1e;
  --rust-dark: #5c2c12;   /* pressed buttons */
  --orange: #e08a2e;      /* use sparingly */
  --ink: #1c1612;
  --ink-soft: #55463b;    /* quieter text on cream */

  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --serif: "Libre Caslon Text", Georgia, serif;
  --body: "Work Sans", system-ui, sans-serif;

  --tap: 48px;            /* smallest size for anything you tap */
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --page: 72rem;
  --radius: 4px;
  --focus: var(--ink);

  /* To use a photo in the hero, put it in /assets and change this line. */
  --hero-image: url("/assets/hero-placeholder.svg");
}

/* 3. Basics ================================================================ */

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

html {
  background: var(--ink);
  color: var(--ink);
  font: 1.125rem/1.6 var(--body);
  -webkit-text-size-adjust: 100%;
}

html.cart-open { overflow: hidden; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}

main { flex: 1; }
main:focus { outline: none; }

h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { min-width: 0; border: 0; }
legend { padding: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; }
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, label { touch-action: manipulation; }

/* Beats any "display" set below, so hidden always means hidden. */
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  z-index: 20;
  top: -6rem;
  left: 1rem;
  padding: 0.75rem 1rem;
  background: var(--cream);
}

.skip-link:focus { top: 0.5rem; }

.container {
  width: 100%;
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 4. Type ================================================================== */

h1, h2, .display {
  font: 400 clamp(2.5rem, 9vw, 4.5rem)/1.08 var(--display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

h2 { font-size: clamp(2rem, 7vw, 3.25rem); }
h3 { font: 700 1.25rem/1.3 var(--body); }

/* Worn screen-print look: tiny holes let the background show through. */
.distressed {
  padding-block: 0.06em;
  -webkit-mask: url("/assets/distress.webp") 0 0 / 300px;
  mask: url("/assets/distress.webp") 0 0 / 300px;
}

.label {
  font: 400 0.875rem/1.5 var(--serif);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* 5. Buttons =============================================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.5rem 1.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--rust);
  color: var(--cream);
  font: 400 1.25rem/1.2 var(--display);
  letter-spacing: 0.05em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 150ms, transform 150ms;
}

.button:active { transform: translateY(1px); background: var(--rust-dark); }
.button:disabled { background: #d9ccb6; color: var(--ink-soft); transform: none; }
.button-wide { width: 100%; }
.button-light { background: var(--cream); color: var(--ink); }
.button-light:active { background: var(--clay); }

.text-button {
  min-height: var(--tap);
  padding: 0 0.25rem;
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (hover: hover) {
  .button:hover:not(:disabled) { background: var(--rust-dark); }
  .button-light:hover:not(:disabled) { background: var(--clay); }
  .text-button:hover { color: var(--rust); }
}

/* 6. Header and footer ===================================================== */

.site-header {
  --focus: var(--orange);
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  gap: clamp(0.125rem, 1vw, 0.75rem);
  min-height: 64px; /* saves the space while the links load */
  padding-inline: clamp(0.75rem, 3vw, 2.5rem);
  background: var(--ink);
  color: var(--cream);
}

.header-logo {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  margin-right: auto;
}

/* The font settings show the name in the display font if the logo can't load. */
.header-logo img {
  width: clamp(5.25rem, 27vw, 8.5rem);
  font: 1.25rem/1 var(--display);
}

.site-header nav { display: flex; }

.site-header nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding-inline: 0.5rem;
  font-weight: 600;
  text-decoration: none;
}

.site-header nav a[aria-current] {
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.4em;
}

.wide-only { display: none !important; }

.cart-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0 0.625rem 0 0.875rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--ink);
  font-weight: 700;
}

.cart-count {
  min-width: 1.75rem;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius);
  background: var(--rust);
  color: var(--cream);
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
}

.notice {
  padding: 0.75rem var(--gutter);
  background: var(--orange);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.notice-closed { background: var(--rust); color: var(--cream); }

.no-script { padding: 1rem var(--gutter); background: var(--orange); }

.site-footer {
  --focus: var(--orange);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  min-height: 24rem;
  padding: 3rem var(--gutter) 2rem;
  background: var(--ink);
  color: var(--cream);
  text-align: center;
}

.footer-logo { width: min(15rem, 70%); font: 1.5rem/1.2 var(--display); }

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 0.5rem;
}

.site-footer nav a {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding-inline: 0.75rem;
}

.copyright { font-size: 1rem; }

@media (hover: hover) {
  .site-header nav a:hover, .site-footer nav a:hover { color: var(--orange); }
  .cart-button:hover { background: var(--clay); }
}

@media (min-width: 45rem) {
  .wide-only { display: flex !important; }
  .site-header { min-height: 76px; }
  .site-header nav a { padding-inline: 1rem; }
}

/* 7. Hero ================================================================== */

.hero {
  --focus: var(--orange);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: min(75rem, calc(100svh - 7rem)); /* lets the next section peek in */
  padding: clamp(2rem, 6vh, 4rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
  background: var(--ink) var(--hero-image) center bottom / cover no-repeat;
  color: var(--cream);
  text-align: center;
}

/* Darkens the bottom so the words are easy to read, even over a photo. */
.hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 62% 0 0;
  background: linear-gradient(transparent, rgb(28 22 18 / 0.9) 50%);
}

/* Print grain on top of the art or the clay color, but behind the words. */
.hero::after, .section-clay::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url("/assets/grain.webp") 0 0 / 128px;
  opacity: 0.3;
  pointer-events: none;
}

.hero-logo img {
  width: min(86vw, 34rem, 60svh);
  font: 3rem/1.1 var(--display);
}

.hero .label { margin-top: 1rem; font-size: 1rem; }

.hero-line {
  max-width: 18em;
  margin: 0 auto 1.25rem;
  font: 400 clamp(1.625rem, 6.5vw, 2.75rem)/1.2 var(--display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

.hero .button { min-width: 14rem; }

@media (min-width: 60rem) {
  .hero-line { max-width: none; }
}

/* 8. Sections ============================================================== */

.section { padding-block: clamp(3rem, 9vw, 6rem); }
.section > .container > h1, .section > .container > h2 { margin-bottom: 1.75rem; }

/* A double row of stitching, like the seam on a work shirt. */
.section-clay {
  position: relative;
  isolation: isolate;
  background: var(--clay);
}

.section-clay::before {
  content: "";
  position: absolute;
  inset: 10px 0 auto;
  height: 8px;
  border-block: 2px dashed var(--rust);
}

.steps { display: grid; gap: 1.75rem; }

.steps li {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  column-gap: 0.5rem;
  align-items: start;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  font: 400 3.25rem/1 var(--display);
}

@media (min-width: 45rem) {
  .steps { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 64rem) {
  .steps { grid-template-columns: repeat(4, 1fr); }
}

.message { padding-block: 2rem; }
.message > * + * { margin-top: 1rem; }
.message-title { font: 400 1.75rem/1.2 var(--display); text-transform: uppercase; }

/* No products yet: a blank shirt lined up for printing. */
.empty-state {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  padding: 3rem 1.5rem;
  background: var(--paper);
  text-align: center;
}

.empty-state .shirt { width: min(13rem, 60%); height: auto; }

.empty-state .display { font-size: clamp(1.875rem, 7vw, 3rem); }

/* Printer's corner marks: one short line across and one down in each corner. */
.empty-state::before {
  --line: linear-gradient(var(--rust) 0 0);
  content: "";
  position: absolute;
  inset: 14px;
  background:
    var(--line) left top / 22px 2px, var(--line) left top / 2px 22px,
    var(--line) right top / 22px 2px, var(--line) right top / 2px 22px,
    var(--line) left bottom / 22px 2px, var(--line) left bottom / 2px 22px,
    var(--line) right bottom / 22px 2px, var(--line) right bottom / 2px 22px;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* 9. Products ============================================================== */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 1.75rem;
}

.filters button {
  min-height: var(--tap);
  padding: 0.25rem 1.125rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: none;
  font-weight: 600;
}

.filters button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 2rem 1.25rem;
}

/* Saves space while products load, so the page doesn't jump. */
.product-area { min-height: 23rem; }
.product-page { min-height: 50rem; }
.success-page { min-height: 30rem; }

.product-card a { display: block; text-decoration: none; }

.product-photo, .gallery-main, .cart-photo {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  background: var(--paper);
}

.product-photo { margin-bottom: 0.875rem; }

.product-photo img, .gallery-main img, .cart-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease-out;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 0.5rem;
  background: var(--clay);
  line-height: 1.3;
  text-align: center;
}

.product-name {
  display: block;
  font: 400 1.5rem/1.2 var(--display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.product-price { display: block; margin-top: 0.25rem; font-weight: 600; }

@media (hover: hover) {
  .product-card a:hover img { transform: scale(1.03); }
  .product-card a:hover .product-name { color: var(--rust); }
  .filters button:hover:not([aria-pressed="true"]) { background: var(--paper); }
}

/* 10. Product page ========================================================= */

.product {
  display: grid;
  gap: 2rem;
  align-items: start;
}

/* Lets the columns shrink instead of pushing the page wide. */
.product > * { min-width: 0; }

.product h1 { font-size: clamp(2.25rem, 8vw, 3.5rem); }
.product-buy { display: grid; gap: 1.5rem; }
.product-buy .product-price { margin: 0; font-size: 1.5rem; }

.made-to-order {
  padding: 1rem;
  border: 2px dashed var(--rust);
  border-radius: var(--radius);
}

.made-to-order strong { display: block; }

.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 0.625rem; }

.gallery-thumbs button {
  min-height: var(--tap);
  padding: 0.25rem 1.125rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: none;
  font-weight: 600;
}

.gallery-thumbs button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }

.options legend, .quantity-label {
  margin-bottom: 0.625rem;
  font-weight: 700;
}

.option-list { display: flex; flex-wrap: wrap; gap: 0.625rem; }

/* Real radio buttons, made to look like big tap buttons. */
.option { position: relative; }

.option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.option span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 56px;
  padding: 0.25rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  font-weight: 700;
  line-height: 1.2;
}

.option small { font-size: 0.875rem; font-weight: 500; }
.option input:checked + span { background: var(--ink); color: var(--cream); }

.option input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.size-help { display: inline-flex; align-items: center; min-height: var(--tap); }

.quantity {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
}

.quantity button {
  width: var(--tap);
  height: var(--tap);
  border: 0;
  background: none;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.quantity button:disabled { color: #8a7c6f; }
.quantity-number { min-width: 2.25rem; font-weight: 700; text-align: center; }

.form-error { color: #8e1c0c; font-weight: 700; }
.form-error:empty { display: none; }
.options .form-error { margin-bottom: 0.625rem; }

@media (min-width: 52rem) {
  .product { grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem); }
}

/* 11. Cart ================================================================= */

.cart-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 28rem);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--cream);
  color: var(--ink);
}

.cart-drawer::backdrop { background: rgb(28 22 18 / 0.7); }

.cart-panel { display: flex; flex-direction: column; height: 100%; }

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding-inline: 1rem;
  border-bottom: 2px solid var(--ink);
}

.cart-header h2 { font-size: 1.75rem; }

.cart-close {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  background: none;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
}

.cart-line {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.75rem;
  align-items: start;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #cdbda2;
}

.cart-line-gone { grid-template-columns: 1fr auto; align-items: center; }
.cart-photo { font-size: 0.875rem; }
.cart-info { min-width: 0; }
.cart-name { display: inline-block; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.cart-details { color: var(--ink-soft); }
.cart-price { font-weight: 700; }

.cart-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.choices { display: grid; gap: 0.625rem; }
.choices legend { margin-bottom: 0.625rem; font-weight: 700; }

.choice-card {
  display: flex;
  gap: 0.875rem;
  padding: 0.875rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
}

.choice-card:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); }

.choice-card input {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.125rem 0 0;
  accent-color: var(--rust);
}

.choice-text { flex: 1; }

.choice-title {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 700;
}

.choice-note { display: block; font-size: 1rem; line-height: 1.4; }

.totals { margin-top: 1.25rem; }

.totals > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.25rem;
}

.totals .totals-final {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
}

.cart-footer {
  padding: 0.875rem 1rem calc(0.875rem + env(safe-area-inset-bottom));
  border-top: 2px solid var(--ink);
}

.cart-footer:empty { display: none; }
.cart-footer .form-error { margin-bottom: 0.625rem; line-height: 1.4; }
.small-note { margin-top: 0.5rem; font-size: 1rem; text-align: center; }

/* 12. Text pages =========================================================== */

.prose { max-width: 42rem; margin-inline: 0; }
.prose > * + * { margin-top: 1.25rem; }
.prose h1 + * { margin-top: 1.5rem; }
.prose h2 { margin-top: 3rem; font-size: clamp(1.75rem, 6vw, 2.25rem); scroll-margin-top: 6rem; }
.prose ul { padding-left: 1.25rem; list-style: disc; }
.prose li + li { margin-top: 0.5rem; }
.prose a { font-weight: 600; overflow-wrap: anywhere; }

.page-links { display: grid; border-top: 1px solid #cdbda2; }

.page-links a, .contact-links a {
  display: flex;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid #cdbda2;
}

.order-summary {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--paper);
}

.order-summary h2 { margin: 0; font-size: 1.5rem; }

.order-summary li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.order-summary ul { padding: 0; list-style: none; }

/* 13. Motion =============================================================== */

/* All movement is in here, so it's off for anyone who asks for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .reveal { transition: opacity 500ms ease-out, transform 500ms ease-out; }
  .reveal.waiting { opacity: 0; transform: translateY(20px); }

  .cart-drawer[open] { animation: drawer-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .cart-drawer[open]::backdrop { animation: fade-in 260ms ease-out; }
  .cart-drawer.closing { animation: drawer-out 200ms ease-in forwards; }
  .cart-drawer.closing::backdrop { animation: fade-out 200ms ease-in forwards; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
