/* ------------------------------------------------------------------
   luisglutting.com — RELIEF
   A typographic relief rendered as a field of strands.
   ------------------------------------------------------------------ */

:root {
  --bg: #ECE7DD;
  --ink: #15130F;
  --accent: #B5432B;
  --ui-alpha: 0.72;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 900ms cubic-bezier(.4,0,.2,1), color 900ms cubic-bezier(.4,0,.2,1);
}

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Interface layer -------------------------------------------- */

.ui {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    calc(22px + env(safe-area-inset-top))
    calc(24px + env(safe-area-inset-right))
    calc(22px + env(safe-area-inset-bottom))
    calc(24px + env(safe-area-inset-left));
  pointer-events: none;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.5;
  opacity: var(--ui-alpha);
}

.ui__top, .ui__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.ui__bottom { align-items: flex-end; }

.ui__name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.ui__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transition: background-color 900ms cubic-bezier(.4,0,.2,1);
  animation: pulse 4.6s cubic-bezier(.45,0,.55,1) infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(.55); opacity: .55; }
}

.ui__field { text-align: right; white-space: nowrap; }

.ui__note { margin: 0; }
.ui__line { display: block; }

.ui__seed {
  pointer-events: auto;
  cursor: pointer;
  appearance: none;
  background: none;
  border: 0;
  padding: 10px 0 10px 10px;
  margin: -10px 0 -10px 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  transition: opacity 300ms ease;
}

.ui__seed-value {
  font-variant-numeric: tabular-nums;
  position: relative;
}

.ui__seed-value::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 420ms cubic-bezier(.65,0,.35,1);
}

.ui__seed:hover .ui__seed-value::after,
.ui__seed:focus-visible .ui__seed-value::after {
  transform: scaleX(1);
  transform-origin: left;
}

.ui__seed-icon {
  display: inline-block;
  transition: transform 700ms cubic-bezier(.65,0,.35,1);
}

.ui__seed:hover .ui__seed-icon { transform: rotate(180deg); }
.ui__seed.is-spinning .ui__seed-icon { transform: rotate(540deg); }

.ui__seed:focus-visible { outline: 1px solid var(--accent); outline-offset: 6px; }

/* Entry choreography of the interface layer */
.ui > * > * {
  opacity: 0;
  transform: translateY(6px);
  animation: ui-in 1100ms cubic-bezier(.2,.7,.2,1) forwards;
}
.ui__top    > :nth-child(1) { animation-delay: 1500ms; }
.ui__top    > :nth-child(2) { animation-delay: 1650ms; }
.ui__bottom > :nth-child(1) { animation-delay: 1900ms; }
.ui__bottom > :nth-child(2) { animation-delay: 2050ms; }

@keyframes ui-in {
  to { opacity: 1; transform: none; }
}

/* ---- Custom cursor (fine pointers only) ----------------------------- */

.cursor { display: none; }

@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  .ui__seed { cursor: none; }
  .cursor {
    display: block;
    position: fixed;
    left: 0; top: 0;
    width: 14px; height: 14px;
    margin: -7px 0 0 -7px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 400ms ease, width 300ms cubic-bezier(.2,.7,.2,1), height 300ms cubic-bezier(.2,.7,.2,1), margin 300ms cubic-bezier(.2,.7,.2,1), border-color 900ms ease;
    will-change: transform;
  }
  .cursor.is-visible { opacity: .9; }
  .cursor.is-active  { width: 34px; height: 34px; margin: -17px 0 0 -17px; border-color: var(--accent); }
  .cursor.is-down    { width: 6px;  height: 6px;  margin: -3px 0 0 -3px; background: var(--accent); border-color: var(--accent); }
}

/* ---- Small screens --------------------------------------------------- */

@media (max-width: 640px) {
  .ui {
    font-size: 10px;
    padding:
      calc(18px + env(safe-area-inset-top))
      calc(18px + env(safe-area-inset-right))
      calc(18px + env(safe-area-inset-bottom))
      calc(18px + env(safe-area-inset-left));
  }
  .ui__field { display: none; }
  .ui__seed-label { display: none; }
}

@media (max-height: 420px) {
  .ui__note { display: none; }
}

/* ---- Reduced motion --------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .ui > * > * { animation: none; opacity: 1; transform: none; }
  .ui__dot { animation: none; }
  .ui__seed-icon, .ui__seed-value::after, .cursor { transition: none; }
  body { transition: none; }
}
