/* ---------------------------------------------------
   Token system
--------------------------------------------------- */
:root {
  --paper:        #ffffff;
  --ink:          #16181d;
  --ink-dim:      #6b7280;
  --ink-soft:     #4b5563;
  --accent:       #b45309;
  --accent-dark:  #8a3d07;
  --accent-soft:  rgba(180, 83, 9, 0.08);
  --rule:         #e5e7eb;
  --card-bg:      #f3f4f6;
  --card-bg-dark: #e7e9ec;

  --font-display: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.intro, .status-block, .legend, .about, .links {
  animation: reveal-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.intro         { animation-delay: 0s; }
.status-block  { animation-delay: 0.1s; }
.legend        { animation-delay: 0.2s; }
.about         { animation-delay: 0.3s; }
.links         { animation-delay: 0.4s; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--paper);
}

body {
  color: var(--ink);
  font-family: var(--font-display);
  display: flex;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------
   Page shell — left-aligned column
--------------------------------------------------- */
.page {
  width: 100%;
  max-width: 640px;
  padding: 9vh 6vw 10vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2.4rem;
  text-align: left;
}

/* ---------------------------------------------------
   Intro — photo + name
--------------------------------------------------- */
.intro {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.avatar {
  width: 168px;
  height: 168px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--card-bg);
  box-shadow: 0 10px 24px -12px rgba(16, 18, 20, 0.25);
}

.name {
  margin: 0;
  font-weight: 800;
  font-size: clamp(2rem, 5.5vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}

/* ---------------------------------------------------
   Status block — the split-flap board, reskinned light
--------------------------------------------------- */
.status-block {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-dim);
}

.board-frame {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: clamp(0.6rem, 1.8vw, 1rem);
  box-shadow: 0 16px 40px -24px rgba(16, 18, 20, 0.18);
  transition: transform 0.15s ease-out, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
  align-self: flex-start;
  max-width: 100%;
}

.board-frame:hover {
  box-shadow:
    0 20px 44px -20px rgba(16, 18, 20, 0.2),
    0 0 0 1px var(--accent-soft);
}

/* Flap spacing now lives on each flap (margin-right) rather than the
   row's flex gap, so a flap can animate its own width AND its own
   spacing down to zero when it's removed — otherwise a "gap" would
   linger even after the flap's width hits 0. */
.flap-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.flap-row::-webkit-scrollbar { display: none; }

.flap {
  position: relative;
  flex: 0 0 auto;
  width: clamp(20px, 6.2vw, 40px);
  height: clamp(30px, 8.6vw, 56px);
  margin-right: clamp(3px, 1vw, 7px);
  background: var(--card-bg);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(16,18,20,0.06);
  perspective: 160px;
  opacity: 1;
  transition:
    width 0.26s cubic-bezier(0.34, 1.2, 0.4, 1),
    margin-right 0.26s cubic-bezier(0.34, 1.2, 0.4, 1),
    opacity 0.2s ease;
}

.flap:last-child { margin-right: 0; }

/* Collapsed state — used both while a flap is entering (before its
   first frame) and while it's exiting, right before removal. */
.flap.flap-collapsed {
  width: 0;
  margin-right: 0;
  opacity: 0;
}

.flap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(16,18,20,0.1);
  transform: translateY(-0.5px);
  z-index: 3;
}

.flap-char {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(1rem, 2.6vw, 1.6rem);
  color: var(--ink);
  background: linear-gradient(180deg, var(--card-bg) 0%, var(--card-bg-dark) 100%);
  transform-origin: 50% 50%;
}

.flap.ticking .flap-char {
  animation: flap-tick 90ms ease-in;
}

@keyframes flap-tick {
  0%   { transform: rotateX(0deg); filter: brightness(1); }
  45%  { transform: rotateX(45deg); filter: brightness(1.06); }
  55%  { transform: rotateX(-8deg); filter: brightness(0.94); }
  100% { transform: rotateX(0deg); filter: brightness(1); }
}

.board-footline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-dim);
}

.live-dot {
  display: inline-flex;
  color: #d9c1a3;
  transition: color 0.4s ease, filter 0.4s ease;
}

.live-dot.on {
  color: var(--accent);
  filter: drop-shadow(0 0 5px rgba(180,83,9,0.6));
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------------------------------------------------
   Status legend
--------------------------------------------------- */
.legend {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

.legend-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.legend-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.5rem;
}

.legend-list li { display: contents; }

.legend-item {
  position: relative;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 0.15rem 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.legend-item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 1.5px;
  background: var(--accent);
  transition: right 0.2s ease;
}

.legend-item:hover,
.legend-item:focus-visible {
  color: var(--accent);
}

.legend-item:hover::after,
.legend-item:focus-visible::after {
  right: 0;
}

.legend-item:focus-visible {
  outline: none;
}

/* ---------------------------------------------------
   About / bio
--------------------------------------------------- */
.about {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 60ch;
}

.about p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ---------------------------------------------------
   Links — plain hyperlink style, no pills
--------------------------------------------------- */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 1.8rem;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(180,83,9,0.3);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease, transform 0.2s ease;
}

.links a svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.links a:hover,
.links a:focus-visible {
  color: var(--accent-dark);
  text-decoration-color: currentColor;
  transform: translateY(-1px);
}

.links a:hover svg { transform: scale(1.1); }

.links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------------------------------------------------
   Small screens
--------------------------------------------------- */
@media (max-width: 380px) {
  .flap { margin-right: 3px; }
}