:root {
  color-scheme: dark;
  --ink: #f6fbff;
  --muted: rgba(232, 242, 248, 0.86);
  --dim: rgba(196, 216, 226, 0.72);
  --cyan: #49ecff;
  --amber: #f5bf68;
  --font-ui: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #05070a;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-ui);
  overflow-x: hidden;
  background: #05070a;
}

.photo-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.photo {
  position: absolute;
  inset: 0;
  background-image:
    image-set(
      url("/assets/andy-lin-portrait-1800.webp") type("image/webp") 1x,
      url("/assets/andy-lin-portrait-2400.webp") type("image/webp") 2x,
      url("/assets/andy-lin-portrait-1800.jpg") type("image/jpeg") 1x
    );
  background-size: cover;
  background-position: 48% 36%;
  background-repeat: no-repeat;
  filter: saturate(0.98) contrast(1.02) brightness(0.97);
  transform: scale(1.02);
}

.photo-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(4, 7, 10, 0.08) 0%,
      rgba(4, 7, 10, 0.16) 30%,
      rgba(4, 7, 10, 0.52) 56%,
      rgba(4, 7, 10, 0.8) 74%,
      rgba(4, 7, 10, 0.9) 100%
    ),
    linear-gradient(
      180deg,
      rgba(4, 7, 10, 0.18) 0%,
      rgba(4, 7, 10, 0.08) 28%,
      rgba(4, 7, 10, 0.28) 72%,
      rgba(4, 7, 10, 0.58) 100%
    );
}

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(20px, 3.5vw, 64px);
}

.profile-panel {
  width: min(640px, 100%);
  max-width: 100%;
  min-width: 0;
  padding: clamp(22px, 3vw, 40px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 1px solid rgba(73, 236, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(8, 12, 18, 0.42), rgba(5, 8, 12, 0.58));
  backdrop-filter: blur(14px) saturate(1.05);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  overflow-wrap: anywhere;
  word-break: normal;
  container-type: inline-size;
  container-name: panel;
}

.profile-panel > * {
  max-width: 100%;
  min-width: 0;
}

.topline {
  margin: 0 0 18px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topline span::before {
  content: "■";
  color: var(--cyan);
  margin-right: 10px;
  text-shadow: 0 0 10px rgba(73, 236, 255, 0.7);
}

.name {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(1.45rem, 1.2rem + 1.4cqi, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.role {
  margin: 0 0 22px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 0.68rem + 0.35cqi, 0.88rem);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.45;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.7rem, 1.25rem + 2.6cqi, 3.05rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.4);
  max-width: 100%;
}

h1 span {
  display: block;
  white-space: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}

.rule {
  width: min(100%, 360px);
  height: 1px;
  margin: 20px 0;
  background: linear-gradient(90deg, var(--cyan), rgba(255, 255, 255, 0.18), transparent);
}

.lede {
  margin: 0;
  max-width: 100%;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: clamp(0.98rem, 0.92rem + 0.35cqi, 1.14rem);
  line-height: 1.58;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.supporting {
  margin: 12px 0 0;
  max-width: 100%;
  color: var(--dim);
  font-family: var(--font-serif);
  font-size: clamp(0.94rem, 0.9rem + 0.25cqi, 1.04rem);
  line-height: 1.55;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  max-width: 100%;
}

.actions a {
  display: inline-flex;
  min-height: 48px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  color: var(--ink);
  text-decoration: none;
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  border-radius: 2px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  display: block;
}

.btn-primary {
  border: 1px solid rgba(73, 236, 255, 0.5);
  background: linear-gradient(135deg, rgba(73, 236, 255, 0.22), rgba(255, 63, 167, 0.12));
  box-shadow: 0 0 18px rgba(73, 236, 255, 0.12);
}

.btn-secondary {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 12, 18, 0.35);
  color: rgba(244, 251, 255, 0.9);
}

.actions a:hover,
.actions a:focus-visible {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(73, 236, 255, 0.18);
  outline: none;
}

/* Mid widths: keep panel fully inside viewport, scale type with container */
@container panel (max-width: 520px) {
  h1 {
    font-size: clamp(1.55rem, 1.1rem + 3.2cqi, 2.35rem);
  }
}

@media (max-width: 1100px) {
  .photo {
    background-position: 50% 34%;
  }

  .photo-scrim {
    background:
      linear-gradient(
        90deg,
        rgba(4, 7, 10, 0.18) 0%,
        rgba(4, 7, 10, 0.36) 40%,
        rgba(4, 7, 10, 0.76) 68%,
        rgba(4, 7, 10, 0.9) 100%
      ),
      linear-gradient(180deg, rgba(4, 7, 10, 0.12), rgba(4, 7, 10, 0.36));
  }

  .profile-panel {
    width: min(560px, 100%);
  }
}

/* Short desktop windows: don't center-clip tall panel */
@media (max-height: 820px) and (min-width: 861px) {
  .site-shell {
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .profile-panel {
    padding: 22px 24px;
  }

  .topline { margin-bottom: 12px; }
  .role { margin-bottom: 14px; }
  .rule { margin: 14px 0; }
  .actions { margin-top: 16px; }
  h1 { line-height: 1.08; }
}

@media (max-width: 860px) {
  .photo-stage {
    position: absolute;
    inset: auto;
    top: 0;
    left: 0;
    right: 0;
    height: 42svh;
  }

  .photo {
    background-position: 50% 20%;
    transform: none;
  }

  .photo-scrim {
    background:
      linear-gradient(
        180deg,
        rgba(4, 7, 10, 0.05) 0%,
        rgba(4, 7, 10, 0.12) 40%,
        rgba(4, 7, 10, 0.55) 78%,
        rgba(4, 7, 10, 0.88) 100%
      );
  }

  .site-shell {
    align-items: stretch;
    justify-content: stretch;
    padding: calc(42svh - 28px) 14px 14px;
  }

  .profile-panel {
    width: 100%;
    padding: 18px 16px 18px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(73, 236, 255, 0.24);
    background: linear-gradient(180deg, rgba(7, 11, 16, 0.92), rgba(4, 7, 10, 0.97));
  }

  .topline { margin-bottom: 10px; }

  .name {
    font-size: clamp(1.4rem, 6vw, 1.7rem);
  }

  .role {
    margin-bottom: 12px;
    letter-spacing: 0.04em;
  }

  h1 {
    font-size: clamp(1.45rem, 5.8vw, 1.95rem);
  }

  .rule { margin: 12px 0; }

  .lede { font-size: 0.94rem; line-height: 1.5; }

  .supporting { margin-top: 8px; font-size: 0.9rem; line-height: 1.48; }

  .actions {
    margin-top: 12px;
    gap: 8px;
  }

  .actions a {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .photo-stage {
    height: 38svh;
  }

  .photo {
    background-position: 50% 18%;
  }

  .site-shell {
    padding-top: calc(38svh - 22px);
  }

  .profile-panel {
    padding: 16px 14px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .actions a {
    transition: none;
  }
}
