:root {
  --text: #f8f4ec;
  --ink: #17191d;
  --muted: #c9c1b7;
  --surface: #fffaf2;
  --surface-text: #1c1f24;
  --line: rgba(255, 250, 242, 0.28);
  --accent: #c75b2c;
  --accent-dark: #8f3c1c;
  --accent-soft: #fff0e7;
  --charcoal: #22262d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --dialog-padding: clamp(1.25rem, 4vw, 2.5rem);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 70% 35%, rgba(199, 91, 44, 0.26), transparent 26rem),
    linear-gradient(135deg, #111318, #262a31);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1rem;
  width: min(17rem, 78vw);
  padding: 1.25rem;
  border-right: 0;
  background: transparent;
  font-family: Helvetica, Arial, sans-serif;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 900;
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 0.82rem;
  height: 0.82rem;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 65% 100%, 0 100%);
}

.nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 0.6rem;
}

.nav button {
  width: 100%;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
  font-weight: 800;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav button:hover,
.nav button:focus-visible {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.16);
}

.portrait-stage {
  min-height: 100vh;
}

.portrait-hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  align-items: end;
  padding: clamp(6rem, 12vh, 9rem) clamp(1rem, 4vw, 3rem) clamp(3rem, 8vh, 5rem);
}

.portrait-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(8, 10, 12, 0.88) 0%, rgba(8, 10, 12, 0.46) 38%, rgba(8, 10, 12, 0.16) 68%),
    linear-gradient(0deg, rgba(8, 10, 12, 0.72) 0%, rgba(8, 10, 12, 0.08) 45%);
  pointer-events: none;
}

.portrait-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.missing-portrait .portrait-hero::after {
  content: "Add your image at public/images/profile.jpg";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: rgba(255, 255, 255, 0.74);
  background:
    linear-gradient(90deg, rgba(22, 24, 28, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 24, 28, 0.035) 1px, transparent 1px),
    #242830;
  background-size: 42px 42px;
  font-weight: 900;
  text-align: center;
}

.hero-copy {
  position: relative;
  z-index: 3;
  max-width: 720px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 0.85rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #ffe0d0;
  background: rgba(199, 91, 44, 0.22);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(4rem, 13vw, 10rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 34rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.info-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(46rem, 48vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0 var(--dialog-padding) var(--dialog-padding);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-right: 0;
  border-radius: 0;
  color: var(--text);
  background: rgba(12, 14, 18, 0.78);
  box-shadow: var(--shadow);
  overflow: auto;
  backdrop-filter: blur(18px);
}

.info-dialog::backdrop {
  background: rgba(5, 6, 8, 0.62);
}

.dialog-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  margin: 0 calc(var(--dialog-padding) * -1) 1.25rem;
  padding: 0.45rem var(--dialog-padding) 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 14, 18, 0.78);
  backdrop-filter: blur(18px);
}

.dialog-header > div {
  min-width: 0;
}

.info-dialog .eyebrow {
  padding: 0.18rem 0.5rem;
  border-color: rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.info-dialog h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.info-dialog p {
  margin: 0 0 1rem;
  color: rgba(248, 244, 236, 0.78);
}

.info-dialog ul {
  margin: 0;
  padding-left: 1.1rem;
  color: rgba(248, 244, 236, 0.78);
}

.project-list,
.race-list {
  display: grid;
  gap: 1.1rem;
}

.project-entry,
.race-entry {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.project-entry h3,
.race-entry h3 {
  margin: 0 0 0.35rem;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.2;
}

.project-entry p,
.race-entry p {
  margin: 0;
}

.project-image {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(42vh, 24rem);
  height: auto;
  margin-top: 0.85rem;
  padding: clamp(0.5rem, 2vw, 1rem);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  object-fit: contain;
}

.pow-email {
  margin-top: 1rem;
}

.pow-button {
  min-height: 2.4rem;
  margin: 0.25rem 0 0.8rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
  font-weight: 800;
}

.pow-button:hover,
.pow-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.16);
}

.pow-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.pow-status {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
}

.revealed-email {
  color: var(--text);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.dialog-close {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.3rem;
  line-height: 1;
}

@media (max-width: 760px) {
  .site-header {
    right: 0;
    bottom: auto;
    width: auto;
    padding: 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(10, 12, 15, 0.82), rgba(10, 12, 15, 0.32));
  }

  .nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    gap: 0.25rem;
  }

  .nav button {
    flex: 1 1 0;
    width: auto;
    min-height: 2rem;
    padding: 0 0.28rem;
    font-size: clamp(0.54rem, 2.45vw, 0.78rem);
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav button[data-dialog="selected-work-dialog"] {
    flex-grow: 1.55;
    text-overflow: clip;
  }

  .portrait-hero {
    min-height: 100svh;
    padding: clamp(9rem, 20vh, 12rem) 1rem 3rem;
  }

  .info-dialog {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    padding: 0 1rem 1rem;
    border: 0;
    overflow: auto;
  }

  .dialog-header {
    margin: 0 -1rem 1rem;
    padding: 0.45rem 1rem 1rem;
  }

  .info-dialog h2 {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(1.2rem, 5.6vw, 1.55rem);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portrait-hero::before {
    background:
      linear-gradient(0deg, rgba(8, 10, 12, 0.88) 0%, rgba(8, 10, 12, 0.26) 72%),
      linear-gradient(90deg, rgba(8, 10, 12, 0.6), rgba(8, 10, 12, 0.08));
  }

}
