/* ==========================================================================
   Rain and Hills — styles
   ========================================================================== */

:root {
  --ink: #0b0b0b;
  --paper: #ffffff;
  --ground: #f1f1ee; /* page behind the white print sheets */
  --muted: #7a7a7a;
  --line: #0b0b0b;

  --font: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --fs-body: 14px;
  --fs-small: 12px;
  --fs-logo: clamp(44px, 5.4vw, 104px);
  --fs-display: clamp(36px, 3.3vw, 64px);

  --gutter: clamp(16px, 5vw, 96px);
  --edge: clamp(16px, 2.4vw, 36px); /* fixed UI inset on the home page */
  --max: 1520px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3, p, figure { margin: 0; }

button { font: inherit; color: inherit; letter-spacing: inherit; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* Underline-on-hover links ------------------------------------------------ */

.top__nav a,
.top__nav button,
.site-footer a,
.print__nav button,
.link-arrow {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s ease;
}
.top__nav a:hover,
.top__nav button:hover,
.site-footer a:hover,
.print__nav button:hover,
.link-arrow:hover { background-size: 100% 1px; }

.link-arrow::after { content: " →"; }

.clock { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Home: fixed canvas ------------------------------------------------------- */

.page-home { background: var(--ground); }

.js .page-home {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

.top,
.bottom {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-inline: var(--edge);
  pointer-events: none; /* let drags through; children re-enable */
}
.top > *,
.bottom > * { pointer-events: auto; }

.top {
  top: 0;
  align-items: baseline;
  padding-top: var(--edge);
}
.top__count { border-bottom: 1px solid currentColor; line-height: 1.3; }
.top__nav { display: flex; gap: clamp(16px, 2.5vw, 40px); }
.top__nav button {
  all: unset;
  cursor: pointer;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s ease;
}
.top__nav button:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.bottom {
  bottom: 0;
  align-items: flex-end;
  padding-bottom: calc(var(--edge) + env(safe-area-inset-bottom, 0px));
  font-size: var(--fs-small);
}
.bottom__coords,
.bottom__copy { flex: 1 1 0; color: var(--muted); }
.bottom__coords { display: flex; flex-direction: column; }
.bottom__coords span:first-child { color: var(--ink); }
.bottom__copy { text-align: right; }
.bottom__mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hint {
  color: var(--muted);
  transition: opacity .6s ease;
}
.hint.is-gone { opacity: 0; }
html:not(.js) .hint,
html:not(.js) .toggle { display: none; }

.toggle {
  display: flex;
  gap: 4px;
  font-size: var(--fs-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.toggle button {
  all: unset;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  cursor: pointer;
  color: var(--muted);
  transition: background-color .25s ease, color .25s ease;
}
.toggle button:hover { color: var(--ink); }
.toggle button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.toggle button:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

.ico { display: block; width: 9px; height: 9px; }
.ico--grid {
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 4px 4px,
    linear-gradient(currentColor, currentColor) 100% 0 / 4px 4px,
    linear-gradient(currentColor, currentColor) 0 100% / 4px 4px,
    linear-gradient(currentColor, currentColor) 100% 100% / 4px 4px;
  background-repeat: no-repeat;
}
.ico--list {
  background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 3px);
}

/* Logo in the middle; the prints slide over it */
.identity {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-content: center;
  justify-items: start; /* tagline lines up with the left edge of the logo */
  pointer-events: none;
}
.identity__logo {
  display: flex;
  flex-direction: column;
  font-size: var(--fs-logo);
  font-weight: 300;
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.identity__tag { margin-top: 1.6em; }
html:not(.js) .identity { position: static; padding: 96px 0 48px; }

/* Stage */
.stage {
  list-style: none;
  margin: 0;
  padding: 0;
}
.js .stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity .28s ease;
}
.js .stage.is-dragging { cursor: grabbing; }
.js .stage.is-switching { opacity: 0; }

.js .item {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.js .stage:not(.is-ready) .item { visibility: hidden; }

.item__btn {
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
  background: var(--paper);
  overflow: hidden;
  animation: item-in .9s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(var(--i) * 55ms);
}
.is-dragging .item__btn { cursor: grabbing; }
.item__btn:focus-visible { outline: 1px solid var(--ink); outline-offset: 6px; }
.item__btn img {
  width: 100%;
  height: auto;
  -webkit-user-drag: none;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}
.item__btn:hover img,
.item__btn:focus-visible img { transform: scale(1.035); }

@keyframes item-in {
  from { opacity: 0; transform: translateY(18px); }
}

.item__cap {
  margin-top: 8px;
  font-size: var(--fs-small);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s ease, transform .3s ease;
}
.item__cap span { color: var(--muted); margin-right: 0.6em; }
.item:hover .item__cap,
.item:focus-within .item__cap,
.stage[data-view="list"] .item__cap { opacity: 1; transform: none; }
@media (hover: none) {
  .item__cap { opacity: 1; transform: none; }
}

/* Without JS: a plain scrolling grid */
html:not(.js) .stage {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 40px 24px;
  padding: 0 var(--edge) 120px;
}
html:not(.js) .item__cap { opacity: 1; transform: none; }
html:not(.js) .top,
html:not(.js) .bottom { position: static; padding-block: var(--edge); }

/* Dialogs ------------------------------------------------------------------ */

dialog.print,
dialog.info {
  border: 0;
  margin: 0;
  padding: 0;
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  overflow: auto;
}
dialog.print::backdrop,
dialog.info::backdrop { background: transparent; }
dialog[open] { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } }

.dialog-close {
  all: unset;
  position: fixed;
  top: var(--edge);
  right: var(--edge);
  z-index: 2;
  cursor: pointer;
}
.dialog-close:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* Print detail */
dialog.print[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  gap: clamp(24px, 5vw, 96px);
  align-items: center;
  padding: clamp(56px, 6vw, 88px) clamp(16px, 6vw, 112px);
}

.print__media {
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100%;
}
.print__media img {
  width: auto;
  max-width: 100%;
  max-height: calc(100dvh - 2 * clamp(56px, 6vw, 88px));
  background: var(--paper);
  animation: print-in .5s cubic-bezier(.2, .7, .2, 1);
}
@keyframes print-in { from { opacity: 0; transform: translateY(12px); } }

.print__panel { display: grid; gap: 0; align-content: center; }

.print__count { color: var(--muted); font-size: var(--fs-small); }
.print__title {
  margin-top: 10px;
  font-size: var(--fs-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}
.print__note { margin-top: 18px; max-width: 34ch; }

.sizes {
  border: 0;
  margin: clamp(28px, 3vw, 44px) 0 0;
  padding: 0;
  min-width: 0;
}
.sizes legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.sizes__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); /* all five in one row when there is room */
  gap: 6px;
}
.size {
  position: relative;
  padding: 10px 2px;
  font-size: 13px;
  text-align: center;
  border: 1px solid rgba(11, 11, 11, .18);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.size input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.size:hover { background: rgba(255, 255, 255, .6); }
.size:has(input:checked) {
  background: var(--paper);
  border-color: var(--ink);
}
.size:has(input:focus-visible) { outline: 1px solid var(--ink); outline-offset: 3px; }

.print__spec {
  margin-top: 14px;
  font-size: var(--fs-small);
  color: var(--muted);
}

.print__buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(24px, 2.6vw, 40px);
}
.print__total { display: flex; flex-direction: column; gap: 2px; }
.print__shipping { font-size: var(--fs-small); color: var(--muted); white-space: nowrap; }
.print__price {
  font-size: clamp(22px, 1.8vw, 28px);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}
.buy {
  all: unset;
  box-sizing: border-box;
  min-width: 55%;
  padding: 16px 28px;
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background-color .2s ease;
}
.buy:hover { background: #2c2c2c; }
.buy:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.print__nav {
  display: flex;
  justify-content: space-between;
  margin-top: clamp(28px, 3vw, 48px);
  font-size: var(--fs-small);
}
.print__nav button {
  all: unset;
  cursor: pointer;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s ease;
}
.print__nav button:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* About */
dialog.info[open] {
  display: grid;
  place-items: center;
  padding: clamp(64px, 8vw, 120px) var(--gutter);
}
.info__body { display: grid; gap: 1.3em; max-width: 56ch; }
.info__title {
  font-size: var(--fs-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
  margin-bottom: 0.3em;
}
.lead {
  font-size: clamp(18px, 1.5vw, 24px);
  line-height: 1.4;
  font-weight: 300;
}
.info__links { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-top: 0.6em; }

/* Footer (subpages) -------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  padding-top: 24px;
  padding-bottom: 32px;
  font-size: var(--fs-small);
  color: var(--muted);
  /* hairline limited to the content box, not the gutters */
  background: linear-gradient(var(--line), var(--line)) top / 100% 1px no-repeat;
  background-origin: content-box;
  background-clip: content-box;
}
.site-footer a { color: var(--ink); }

/* Reveal on scroll -------------------------------------------------------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .item__btn,
  .print__media img,
  dialog[open] { animation: none; }
  .js .stage { transition: none; }
}

/* Story subpage (pribeh.html) --------------------------------------------- */

@font-face {
  font-family: "Onte Normal One";
  src: url("../fonts/OnteNormalOne-Regular.woff2") format("woff2"),
       url("../fonts/OnteNormalOne-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.story-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: clamp(24px, 3vw, 48px);
}
.story-logo {
  font-weight: 300;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.story-back { color: var(--muted); transition: color .2s ease; }
.story-back:hover { color: var(--ink); }

.story {
  min-height: calc(100dvh - 160px);
  display: grid;
  align-content: center;
  padding-block: clamp(64px, 10vw, 160px);
}
.story__text {
  font-family: "Onte Normal One", var(--font);
  font-size: clamp(26px, 3.2vw, 52px);
  line-height: 1.3;
  letter-spacing: 0;
  max-width: 28ch;
  margin-inline: auto;
  text-wrap: pretty;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 860px) {
  :root {
    --fs-display: clamp(34px, 9vw, 52px);
    --fs-logo: clamp(48px, 15vw, 96px);
  }

  .bottom__coords,
  .bottom__copy { display: none; }
  .bottom { justify-content: center; }

  /* stacked and scrollable: image first, then the panel */
  dialog.print[open] {
    display: block;
    padding: 64px 16px 40px;
  }
  .print__media { display: block; height: auto; }
  .print__media img { max-height: 62dvh; margin-inline: auto; }
  .print__panel { margin-top: 28px; }

  .site-footer { flex-direction: column; }
}
