:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --fg: #f3f1ec;
  --name: #f6f1e6;
  --muted: #a8a399;
  --faint: #8a867e;
  --farm-glow: rgba(92, 140, 72, 0.4);
  --link: var(--fg);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #efece4;
  --fg: #1c1a16;
  --name: #16130f;
  --muted: #5a564f;
  --faint: #68645c;
  --farm-glow: rgba(168, 196, 118, 0.55);
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../assets/fonts/instrument-sans-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/outfit-500-latin.woff2") format("woff2");
}

* { box-sizing: border-box; }

html {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  color: var(--fg);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg);
}

::selection {
  background: rgba(92, 140, 72, 0.38);
  color: var(--fg);
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  -webkit-tap-highlight-color: transparent;
}

a:hover { opacity: 0.72; }

a:focus-visible,
.theme:focus-visible,
.mute:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 4px;
}

.top {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding:
    calc(1.5rem + env(safe-area-inset-top))
    calc(1.5rem + env(safe-area-inset-right))
    0
    calc(1.5rem + env(safe-area-inset-left));
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
}

.top a.name {
  color: var(--name);
  text-decoration: none;
  font-family: "Outfit", "Instrument Sans", ui-sans-serif, sans-serif;
  font-weight: 500;
  font-size: 2.15rem;
  letter-spacing: -0.034em;
  word-spacing: 0.02em;
  line-height: 1;
  padding: 0.12em 0;
  margin: 0;
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  text-wrap: nowrap;
  overflow: visible;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: color 0.15s ease;
}

.top a.name:hover {
  opacity: 1;
  color: var(--muted);
}

.theme {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.theme:hover { color: var(--fg); }

main {
  flex: 1 0 auto;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding:
    0.35rem
    calc(1.5rem + env(safe-area-inset-right))
    2.75rem
    calc(1.5rem + env(safe-area-inset-left));
  overflow: visible;
  background: none;
}

.farm-glow {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: min(64rem, 100%);
  margin-inline: auto;
  background: radial-gradient(ellipse 42% 38vh at 50% 34vh, var(--farm-glow) 0%, transparent 100%);
  background-repeat: no-repeat;
}

.farm-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(52vh, 32rem);
  margin: 0 auto;
  overflow: visible;
  background: none;
}

.farm-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.farm-wait {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 1;
  display: flex;
  gap: 0.42rem;
  margin: 0;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.35s ease;
}

.farm-stage.is-waiting .farm-wait { opacity: 1; }

.farm-wait-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.35;
  animation: farm-wait 1.15s ease-in-out infinite;
}

.farm-wait-dot:nth-child(2) { animation-delay: 0.16s; }
.farm-wait-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes farm-wait {
  0%, 80%, 100% { opacity: 0.28; transform: none; }
  40% { opacity: 0.9; transform: translateY(-3px); }
}

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

.farm-stage.is-waiting #farm,
.farm-stage.is-waiting .mute {
  opacity: 0;
  pointer-events: none;
}

.mute {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  right: 1rem;
  bottom: 22%;
  z-index: 2;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.55);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: background 0.15s ease, opacity 0.35s ease;
}

.mute:hover {
  background: rgba(10, 10, 10, 0.78);
}

.mute svg {
  width: 16px;
  height: 16px;
  display: block;
  overflow: visible;
}

.mute.is-on .slash { display: none; }
.mute:not(.is-on) .wave { display: none; }

.mute:focus-visible {
  outline-color: #fff;
  outline-offset: 3px;
}

.sheep-tag {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(12, 12, 12, 0.82);
  color: #f6f1e6;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 0.28em 0.5em 0.32em;
  border-radius: 4px;
  white-space: nowrap;
  transform: translate(-50%, -110%);
}

#farm {
  display: block;
  background: transparent;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: default;
  max-width: 100%;
  height: auto !important;
  transition: opacity 0.35s ease;
}

.hint {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.bio {
  max-width: 36rem;
  margin: 0.75rem auto 0;
  font-size: 1.08rem;
  line-height: 1.55;
  letter-spacing: -0.018em;
  text-align: center;
  background: none;
}

.seen {
  display: block;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-wrap: pretty;
}

.seen .when {
  white-space: nowrap;
}

.sep {
  margin: 0 0.72em;
  font-weight: 500;
  color: inherit;
  user-select: none;
}

.work {
  max-width: 36rem;
  margin: 3.5rem auto 0;
  text-align: center;
}

.work h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--faint);
}

.work ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.work .row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0 0.5rem;
  padding: 0.125rem 0;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.022em;
  color: inherit;
  text-decoration: none;
  line-height: 1.6;
}

.work a.row {
  cursor: pointer;
  transition: color 0.15s ease;
}

.work a.row:hover {
  opacity: 1;
}

.work a.row:hover .title {
  color: var(--muted);
}

.work .yr {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.foot {
  position: relative;
  z-index: 1;
  max-width: 36rem;
  width: 100%;
  margin: 0 auto;
  padding:
    0
    calc(1.5rem + env(safe-area-inset-right))
    calc(2.5rem + env(safe-area-inset-bottom))
    calc(1.5rem + env(safe-area-inset-left));
  color: var(--muted);
  font-size: 0.92rem;
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
}

.foot a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.foot a:hover { color: var(--fg); opacity: 1; }

.lost-note {
  text-align: center;
  margin-top: 0.5rem;
}

.lost-note a { color: var(--fg); }

@media (max-width: 640px) {
  .bio { font-size: 1rem; }
  .work .row { font-size: 1.12rem; }
  .work h2 { font-size: 1.12rem; }
  .farm-wrap { min-height: min(62vh, 28rem); }
  .top a.name { font-size: 1.72rem; letter-spacing: -0.03em; }
}

@media (prefers-reduced-motion: reduce) {
  .top a.name,
  .theme,
  .mute,
  .work a.row,
  .foot a,
  #farm,
  .farm-wait {
    transition: none;
  }

  .farm-wait-dot {
    animation: none;
    opacity: 0.7;
  }
}
