* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --text: #1d1d1d;
  --text-secondary: #555;
  --border: #eee;
  --bg: #fff;
  --coral: #F06B60;
}

html {
  height: 100%;
  scroll-behavior: smooth;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ---- inline research links ---- */
.row-text a.research-link,
.page-inner a.research-link {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
  cursor: pointer;
}

.row-text a.research-link:hover,
.page-inner a.research-link:hover {
  opacity: 0.7;
}

/* ---- fonts: Times New Roman titles + Space Mono body ---- */
body { font-family: 'Space Mono', monospace; }
h2   { font-family: 'Times New Roman', Times, serif; }

/* ---- nav ---- */
nav {
  position: fixed;
  bottom: clamp(1.5rem, 4vh, 3rem);
  right: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.8rem);
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 40vw;
  z-index: 10;
}

nav a {
  font-family: 'Times New Roman', Times, serif;
  font-size: 13px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  transition: color 0.2s;
}

nav a:hover {
  color: var(--text);
}

nav a.active {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- row (two-panel, full viewport) ---- */
.row {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

.row.reverse {
  flex-direction: row-reverse;
}

.row-image {
  flex: 3;
  min-width: 0;
  min-height: 100vh;
  max-height: 100vh;
  position: relative;
  overflow: hidden;
}

.row-image > img {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  max-height: 100vh;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}


.logo-cycle {
  position: relative;
  width: 100%;
  height: 100%;
}

.logo-cycle img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: none;
}

/* ---- text panel: anchored bottom-right ---- */
.row-text {
  flex: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3rem) clamp(5rem, 12vh, 10rem);
  min-width: 0;
  max-width: 50vw;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
}

.row-text .label,
.label {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  word-wrap: break-word;
}

h2 {
  font-size: clamp(20px, 3.5vw, 26px);
  font-weight: 400;
  font-style: italic;
  margin-bottom: 1.2rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.row-text p {
  font-size: clamp(11px, 1.8vw, 13px);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.6rem;
  max-width: min(380px, 90%);
  word-wrap: break-word;
}

.row-text p:last-child {
  margin-bottom: 0;
}

/* ---- CTA button ---- */
.cta-button {
  display: inline-block;
  font-size: 12px;
  font-weight: 400;
  color: var(--bg);
  background: var(--coral);
  border: none;
  border-radius: 100px;
  padding: 0.6rem 1.8rem;
  margin-top: 1.5rem;
  transition: opacity 0.2s;
  text-decoration: none;
}

.cta-button:hover {
  opacity: 0.85;
}

/* ---- steps ---- */
.steps {
  margin-top: 0.8rem;
}

.step {
  display: flex;
  gap: 0.8rem;
  padding: 0.35rem 0;
  align-items: baseline;
  justify-content: flex-end;
}

.step-n {
  font-size: 10px;
  color: var(--text-secondary);
  order: 2;
}

.step-label {
  font-size: 12px;
  color: var(--text-secondary);
  order: 1;
}

/* ---- tags ---- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
  justify-content: flex-end;
}

.tags span {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: border-color 0.2s;
}

.tags span:hover {
  border-color: var(--text-secondary);
}

/* ---- coming soon badge ---- */
.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--coral);
  border: 1px solid var(--coral);
  border-radius: 100px;
  padding: 0.2rem 0.6rem;
  margin-top: 1rem;
}

/* ---- text-only pages ---- */
.page-center {
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 3rem 3rem 10rem;
}

.page-inner {
  max-width: min(420px, 90%);
  text-align: right;
  word-wrap: break-word;
}

.page-inner p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.page-inner p:last-child {
  margin-bottom: 0;
}

.contact-inner {
  max-width: min(380px, 90%);
  width: 100%;
  text-align: right;
  word-wrap: break-word;
}

/* ---- references page special layout ---- */
.references-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.references-header {
  width: 100%;
  height: 40vh;
  min-height: 300px;
  max-height: 500px;
  overflow: hidden;
  position: relative;
}

.references-header img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.references-content {
  flex: 1;
  padding: 3rem clamp(2rem, 8vw, 12rem) calc(8rem + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.references-inner {
  max-width: 900px;
  width: 100%;
  text-align: left;
}

.references-list {
  margin-top: 1.5rem;
}

.references-list p {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  margin-bottom: 1.2rem;
  text-indent: -1.5rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.references-list em {
  font-style: italic;
}

.contact-inner h2 {
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  text-align: right;
}

.form-group input,
.form-group textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 300;
  padding: 0.5rem 0;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  background: transparent;
  color: var(--text);
  text-align: right;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--text);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-button {
  display: inline-block;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  background: none;
  border: 1px solid var(--text);
  border-radius: 100px;
  padding: 0.5rem 1.6rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.8rem;
}

.form-button:hover {
  background: var(--text);
  color: var(--bg);
}

/* ---- zoom adaptation ---- */
@media (max-width: 1200px) {
  .row-text {
    max-width: 55vw;
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.5rem, 3vw, 2.5rem) clamp(4rem, 10vh, 8rem);
  }

  .row.reverse .row-text {
    max-width: 65vw;
  }

  nav {
    max-width: 50vw;
    gap: clamp(0.6rem, 1.5vw, 1.5rem);
  }

  h2 {
    font-size: clamp(18px, 3vw, 24px);
  }

  .row-text p {
    font-size: clamp(10px, 1.6vw, 12px);
  }
}

/* ---- narrow windows: switch to single column ---- */
@media (max-width: 900px) {
  .row,
  .row.reverse {
    flex-direction: column;
    overflow-y: auto;
    min-height: auto;
  }

  .row-image {
    min-height: 50vh;
    max-height: 50vh;
    width: 100%;
  }

  .row-image > img {
    min-height: 50vh;
    width: 100%;
  }

  .row-text {
    max-width: 100%;
    padding: 2rem 2rem 7rem;
    min-height: auto;
  }

  nav {
    max-width: 70vw;
    bottom: 1.5rem;
    right: 1.5rem;
  }
}

/* ---- tablet: optimize layout ---- */
@media (max-width: 768px) {
  nav {
    bottom: 1.2rem;
    right: 1.2rem;
    left: auto;
    max-width: 75vw;
    gap: clamp(0.5rem, 1.5vw, 0.8rem);
  }

  nav a {
    font-size: 10px;
    white-space: nowrap;
  }

  .row,
  .row.reverse {
    flex-direction: column;
    min-height: auto;
  }

  .row-image {
    min-height: 45vh;
    max-height: 45vh;
  }

  .row-image > img {
    min-height: 45vh;
  }

  .row-text {
    padding: 1.8rem 1.8rem 6rem;
    align-items: flex-start;
    text-align: left;
  }

  .row-text p {
    font-size: 13px;
    max-width: 100%;
  }

  h2 {
    font-size: 24px;
  }

  .page-center {
    padding: 1.8rem 1.8rem 6rem;
    align-items: flex-start;
  }

  .page-inner {
    max-width: 100%;
    text-align: left;
  }

  .page-inner p {
    font-size: 13px;
  }

  .contact-inner {
    max-width: 100%;
    text-align: left;
  }

  .contact-inner h2,
  .page-inner h2 {
    text-align: left;
  }

  .references-inner {
    text-align: left;
  }

  .references-inner h2 {
    text-align: left;
  }

  .form-group label,
  .form-group input,
  .form-group textarea {
    text-align: left;
  }

  .steps {
    align-items: flex-start;
  }

  .step {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }

  .tags {
    justify-content: flex-start;
  }

  .cta-button {
    align-self: flex-start;
  }
}

/* ---- mobile: comprehensive optimization ---- */
@media (max-width: 480px) {
  body {
    font-size: 13px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  nav {
    bottom: max(1rem, env(safe-area-inset-bottom));
    right: 1rem;
    left: 1rem;
    max-width: none;
    gap: 0.6rem;
    justify-content: center;
    background: rgba(255, 255, 255, 0.98);
    padding: 0.9rem 1.2rem;
    padding-bottom: calc(0.9rem + env(safe-area-inset-bottom));
    border-radius: 100px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
  }

  nav a {
    font-size: 11px;
    white-space: nowrap;
    padding: 0.3rem 0.5rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .row,
  .row.reverse {
    min-height: auto;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
  }

  .row-image {
    min-height: 30vh;
    max-height: 30vh;
  }

  .row-image > img {
    min-height: 30vh;
    object-fit: contain;
    object-position: center;
  }

  .logo-cycle {
    min-height: 30vh;
  }

  .row-text {
    padding: 1.5rem 1.5rem calc(7rem + env(safe-area-inset-bottom));
    min-height: auto;
    overflow-y: visible;
  }

  .row-text .label,
  .label {
    font-size: 9px;
    margin-bottom: 0.8rem;
    letter-spacing: 0.06em;
  }

  h2 {
    font-size: 22px;
    margin-bottom: 1rem;
    line-height: 1.3;
  }

  .row-text p,
  .page-inner p {
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 0.8rem;
  }

  .cta-button {
    font-size: 12px;
    padding: 0.9rem 2rem;
    margin-top: 1.5rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .step {
    gap: 0.8rem;
    padding: 0.5rem 0;
  }

  .step-label {
    font-size: 12px;
  }

  .step-n {
    font-size: 10px;
  }

  .tags {
    gap: 0.5rem;
    margin-top: 1.2rem;
  }

  .tags span {
    font-size: 11px;
    padding: 0.4rem 0.8rem;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }

  .badge {
    font-size: 9px;
    padding: 0.4rem 0.8rem;
    margin-top: 1.2rem;
  }

  .page-center {
    padding: 2rem 1.5rem calc(6rem + env(safe-area-inset-bottom));
  }

  .page-inner,
  .references-inner {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .subtitle {
    font-size: 12px;
    margin-bottom: 1.8rem;
  }

  .form-group {
    margin-bottom: 1.5rem;
  }

  .form-group label {
    font-size: 11px;
    margin-bottom: 0.5rem;
  }

  .form-group input,
  .form-group textarea {
    font-size: 16px;
    padding: 0.8rem 0;
    min-height: 44px;
    border-bottom-width: 1.5px;
  }

  .form-group textarea {
    min-height: 100px;
  }

  .form-button {
    font-size: 12px;
    padding: 0.9rem 2rem;
    margin-top: 1.5rem;
    min-height: 44px;
  }

  .references-list p {
    font-size: 10px;
    line-height: 1.7;
    margin-bottom: 1.5rem;
  }

  .references-inner,
  .contact-inner {
    max-width: 100%;
  }

  .references-header {
    height: 30vh;
    min-height: 200px;
    max-height: 300px;
  }

  .references-content {
    padding: 2rem 1.5rem calc(7rem + env(safe-area-inset-bottom));
  }

  .references-list p {
    font-size: 10px;
  }
}
