@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif.woff2") format("woff2");
}

:root {
  --paper: #f3eee6;
  --paper-deep: #e9e2d6;
  --ink: #2e2922;
  --ink-hover: #1f1b16;
  --muted: #857b6b;
  --line: #d6cbb8;
  --line-strong: #bcae95;
  --error: #8b493e;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.name {
  margin: 0;
  font: 400 56px/0.95 var(--serif);
  letter-spacing: -0.01em;
}

/* ---------- Links ---------- */

.link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 0 8px 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.link:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.45); }
.link:active { transform: scale(0.985); }
.link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.link-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--paper-deep);
  transition: transform 0.15s ease;
}

.link-main {
  min-height: 60px;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.link-main:hover { border-color: var(--ink-hover); background: var(--ink-hover); }
.link-main .link-icon { background: var(--paper); color: var(--ink); }
.link-main:hover .link-icon { transform: rotate(45deg); }

/* ---------- Profile ---------- */

/* One screen, no scrolling: the photo takes whatever height the sheet leaves. */
.profile {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
}

.photo {
  display: block;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  object-position: center 30%;
  background: var(--paper-deep);
}

/* The sheet slides up over the bottom of the photo. */
.sheet {
  position: relative;
  flex: none;
  margin-top: -26px;
  padding: 28px 20px max(20px, env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--paper);
}

.meta {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.meta span { margin: 0 4px; }

.links { display: grid; gap: 10px; margin-top: 22px; }

.note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Short screens (small phones, landscape): tighten so the buttons still fit. */
@media (max-height: 640px) {
  .profile .name { font-size: 44px; }
  .sheet { padding-top: 22px; }
  .links { margin-top: 16px; gap: 8px; }
  .profile .link { min-height: 50px; }
  .profile .link-main { min-height: 54px; }
  .note { margin-top: 10px; }
}

@media (max-height: 460px) {
  .profile .name { font-size: 34px; }
  .meta { margin-top: 4px; }
  .sheet { margin-top: -18px; padding: 16px 20px max(12px, env(safe-area-inset-bottom)); }
  .links { grid-template-columns: 1fr 1fr; margin-top: 12px; }
  .profile .link, .profile .link-main { min-height: 46px; }
  .note { display: none; }
}

/* Bigger screens: a floating card instead of edge to edge. */
@media (min-width: 520px) {
  html:has(.profile), html:has(.profile) body { background: var(--paper-deep); }
  body:has(.profile) { display: grid; place-items: center; height: 100vh; height: 100dvh; padding: 24px 16px; }
  .profile {
    height: min(860px, calc(100dvh - 48px));
    border-radius: 26px;
    background: var(--paper);
    box-shadow: 0 18px 60px rgba(46, 41, 34, 0.12);
  }
  .sheet { padding: 30px 26px 26px; }
}

/* ---------- Gate ---------- */

.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px 20px;
  text-align: center;
}

.progress {
  position: relative;
  width: 72px;
  height: 2px;
  margin: 26px 0 18px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: var(--ink);
  animation: slide 1.2s ease-in-out infinite;
}

.gate[data-state="error"] .progress { visibility: hidden; }

.status {
  max-width: 300px;
  min-height: 22px;
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.gate[data-state="error"] .status { color: var(--error); }

#verification { display: flex; justify-content: center; width: min(100%, 300px); }

.link-retry {
  justify-content: center;
  width: auto;
  min-height: 46px;
  margin-top: 4px;
  padding: 0 28px;
}

/* ---------- Motion ---------- */

@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: no-preference) {
  .sheet > * { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .sheet > :nth-child(2) { animation-delay: 0.04s; }
  .sheet > :nth-child(3) { animation-delay: 0.08s; }
  .sheet > :nth-child(4) { animation-delay: 0.12s; }
}

@media (prefers-reduced-motion: reduce) {
  .progress::after { animation: none; width: 100%; opacity: 0.5; }
  .link, .link-icon { transition: none; }
}
