/* ----- Reckless (local, Light) ----- */
@font-face {
  font-family: "Reckless";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("assets/fonts/RecklessStandardS-Light.woff") format("woff");
}

/* ----- Variables ----- */
:root {
  --bg: #f5f5f4;
  --content-bg: #ffffff;
  --text: #525253;
  --text-muted: #525252;
  --hero-text: #1c1c1c;
  --link: #525252;
  --link-underline: #737373;
  --border: #e5e5e5;
}

[data-theme="dark"] {
  --bg: #171717;
  --content-bg: #262626;
  --text: #fafafa;
  --text-muted: #fafafa;
  --hero-text: #fafafa;
  --link: #fafafa;
  --link-underline: #a3a3a3;
  --border: #404040;
}

/* ----- Base ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  font-family: "DM Mono", ui-monospace, monospace;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

.page-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--link-underline);
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* ----- Header ----- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .75rem 1rem 1.25rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.logo {
  border: none;
  font-size: 16px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-nav a {
  font-size: 16px;
  border: none;
  border-bottom: 1px solid transparent;
}

.header-nav a:hover {
  border-bottom-color: var(--link-underline);
}

.theme-toggle {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: opacity 0.2s ease;
}

.theme-toggle:hover {
  opacity: 0.85;
}

.theme-toggle-icons {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
}

.theme-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  display: block;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}

.theme-icon--light {
  transform: rotate(0deg);
  opacity: 1;
}

.theme-icon--dark {
  transform: rotate(-90deg);
  opacity: 0;
}

[data-theme="dark"] .theme-icon--light {
  transform: rotate(90deg);
  opacity: 0;
}

[data-theme="dark"] .theme-icon--dark {
  transform: rotate(0deg);
  opacity: 1;
}

/* ----- Main ----- (mobile-first) ----- */
.main-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 1.5rem 1.25rem 2rem;
  width: 100%;
  overflow: visible;
}

.main-content-text {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: left;
  order: 1;
  background: transparent;
}

.main-content-text .hero-heading + .hero-body,
.main-content-text .hero-body + .roles {
  margin-top: 0.75rem;
}

.main-content-bg {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  order: 2;
  margin-top: auto;
  width: 100%;
}

.main-content-bg .theme-video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: bottom right;
}

/* Crop coffee illustration (index 1) to remove border */
.main-content-bg[data-illustration-index="1"] .theme-video {
  object-fit: cover;
  object-position: center center;
}

.main-content-bg .theme-video--dark {
  display: none;
}

[data-theme="dark"] .main-content-bg .theme-video--light {
  display: none;
}

[data-theme="dark"] .main-content-bg .theme-video--dark {
  display: block;
}

.hero-heading {
  font-family: "Reckless", Georgia, serif;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 300;
  margin: 0;
  line-height: 100%;
  color: var(--hero-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hero-body {
  font-size: 16px;
  margin: 0;
  line-height: 1.55;
  max-width: 700px;
}

/* ----- Mobile ----- */
@media (max-width: 767px) {
  .page-card {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .site-header {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
  }

  .main-content {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
  }

  .site-footer {
    padding-top: 1.5rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
  }

  .theme-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  .main-content-text {
    margin-top: 2rem;
    background: transparent;
  }

  body.footer-out-of-view .main-content-text {
    margin-top: 2rem;
  }

  .main-content-bg {
    width: 100%;
    height: min(54vh, 320px);
    max-height: min(54vh, 320px);
    justify-content: flex-end;
    align-items: flex-end;
    align-self: flex-end;
    margin-top: 0.75rem;
    margin-bottom: -2rem;
    padding-right: 0;
    padding-bottom: 0;
    overflow: visible;
  }

  .main-content-bg .theme-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: right bottom;
    margin: 0;
    align-self: stretch;
  }

  .main-content-bg[data-illustration-index="1"] .theme-video {
    object-fit: cover;
    object-position: center center;
  }

  .hero-heading {
    font-size: 46px;
  }

  a {
    -webkit-tap-highlight-color: transparent;
  }
}

@media (min-width: 768px) {
  .site-header {
    padding: 32px;
    padding-right: 0.75rem;
  }

  .main-content {
    justify-content: center;
    align-items: center;
    padding: 32px;
    overflow: visible;
  }

  .main-content-text {
    max-width: 100%;
    order: unset;
  }

  .main-content-bg {
    margin-top: 0;
    order: unset;
    min-height: 0;
    position: relative;
  }

  .main-content-bg .theme-video {
    position: relative;
    inset: unset;
    max-width: min(750px, 45vw);
    width: min(750px, 45vw);
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
  }

  .main-content-bg[data-illustration-index="1"] .theme-video {
    object-fit: cover;
    object-position: center center;
    max-width: min(660px, 40vw);
    width: min(660px, 40vw);
  }

  .site-footer {
    padding: 32px;
  }

  .hero-heading {
    font-size: 96px;
    font-weight: 300;
  }
}

/* Only overlap illustration with text when there's enough room */
@media (min-width: 1200px) {
  .main-content-bg {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 750px;
    height: 750px;
    padding: 0;
    transform: translate(8%, calc(8% + 100px));
  }

  .main-content-bg[data-illustration-index="1"] {
    width: 660px;
    height: 660px;
  }

  .main-content-bg .theme-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: unset;
    object-fit: contain;
    object-position: bottom right;
  }

  .main-content-bg[data-illustration-index="1"] .theme-video {
    object-fit: cover;
    object-position: center center;
  }
}

.roles {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0;
}

.roles a {
  color: var(--link);
  border-bottom: 1px solid var(--link-underline);
}

/* ----- Footer ----- */
.site-footer {
  position: sticky;
  bottom: 0;
  padding: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 16px;
  background-color: var(--bg);
  z-index: 1;
}

.site-footer a {
  border: none;
  border-bottom: 1px solid transparent;
}

.site-footer a:hover {
  border-bottom-color: var(--link-underline);
}

/* ----- Work page (password protected) ----- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.work-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 12rem);
  padding: 2rem 1.25rem 2rem;
  width: 100%;
}

.work-gate,
.work-content {
  text-align: center;
  max-width: 28rem;
  width: 100%;
}

@media (min-width: 768px) {
  .work-page {
    padding: 32px;
  }
}

.work-gate-heading,
.work-content-heading {
  font-family: "Reckless", Georgia, serif;
  font-weight: 300;
  margin: 0 0 0.5rem;
  color: var(--hero-text);
  -webkit-font-smoothing: antialiased;
}

.work-gate-heading,
.work-content-heading {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
}

@media (min-width: 768px) {
  .work-gate-heading,
  .work-content-heading {
    font-size: 96px;
  }
}

.work-gate-text,
.work-content-intro {
  font-size: 16px;
  margin: 0 0 1.5rem;
  color: var(--text);
  line-height: 1.55;
}

.work-gate-form {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.work-gate-input {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 16px;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: var(--content-bg);
  color: var(--text);
  min-width: 12rem;
  box-shadow:
    0 0 0 2px var(--text),
    0 0 8px 2px rgba(0, 0, 0, 0.08);
}

.work-gate-input::placeholder {
  color: var(--text);
  opacity: 0.6;
}

.work-gate-input:focus {
  outline: none;
  box-shadow:
    0 0 0 2.5px var(--link-underline),
    0 0 10px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .work-gate-input {
  box-shadow:
    0 0 0 2px var(--text),
    0 0 8px 2px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .work-gate-input:focus {
  box-shadow:
    0 0 0 2.5px var(--link-underline),
    0 0 10px 3px rgba(255, 255, 255, 0.12);
}

.work-gate-error {
  font-size: 14px;
  color: var(--text);
  margin: 0;
  opacity: 0.9;
}
