/* ===== RESET ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== BASE ===== */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'PT Mono', monospace;
  background: #fff;
  color: #000;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: #000;
  color: #fff;
}

/* ===== SCROLLBAR (custom) ===== */
html,
.overlay-inner {
  scrollbar-width: none;
}

html::-webkit-scrollbar,
.overlay-inner::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  -webkit-appearance: none;
  background: transparent;
}

.custom-scrollbar {
  position: fixed;
  top: 0;
  right: 0;
  width: 5px;
  height: 100vh;
  z-index: 9999;
  pointer-events: none;
}

.custom-scrollbar-thumb {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  background: #999;
  min-height: 30px;
}

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport height for mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 8vh, 80px) clamp(20px, 4vw, 24px);
}

.hero-content {
  max-width: 620px;
  width: 100%;
}

.hero-content p {
  margin-bottom: 1.6em;
  font-size: 1rem;
}

.hero-content strong {
  font-weight: 700;
}

/* Thesis list */
.thesis {
  list-style: disc;
  margin-bottom: 1.6em;
  padding-left: 1.2em;
}

.thesis li {
  margin-bottom: 0.3em;
}

/* GP links */
.gp-link {
  color: #000;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid #000;
  transition: border-color 0.2s;
}

.gp-link:hover {
  border-bottom-color: transparent;
}

/* Action links (HERE, APPLY) */
.action-link {
  color: #000;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid #000;
  transition: border-color 0.2s;
}

.action-link:hover {
  border-bottom-color: transparent;
}

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

thead th {
  text-align: left;
  font-weight: 700;
  padding: 12px 16px 12px 0;
  border-bottom: 2px solid #000;
}

tbody td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid #000;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 2px solid #000;
}

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay-inner {
  width: 100%;
  max-width: 520px;
  padding: 40px 24px;
  max-height: 100dvh;
  max-height: 100vh; /* fallback */
  overflow-y: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

@supports (max-height: 100dvh) {
  .overlay-inner {
    max-height: 100dvh;
  }
}

.overlay-inner--wide {
  max-width: 960px;
}

.overlay-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2em;
}

.overlay-close {
  position: absolute;
  top: 0;
  right: 12px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #000;
  line-height: 1;
  font-family: 'PT Mono', monospace;
  transition: opacity 0.2s;
}

.overlay-close:hover {
  opacity: 0.4;
}

/* ===== FORM (shared) ===== */
#apply-form h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.2em;
}

#apply-form label,
#sf2023-form label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.4em;
  font-weight: 700;
}

.field {
  margin-bottom: 1.8em;
}

#apply-form input,
#apply-form textarea {
  display: block;
  width: 100%;
  font-family: 'PT Mono', monospace;
  font-size: 0.95rem;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid #000;
  background: transparent;
  color: #000;
  outline: none;
  margin-bottom: 0;
  border-radius: 0;
  -webkit-appearance: none;
  transition: border-color 0.2s, border-bottom-color 0.2s;
}

#apply-form input:focus,
#apply-form textarea:focus {
  border-bottom-width: 2px;
}

#apply-form textarea {
  resize: vertical;
  min-height: 80px;
}

/* Validation */
.field-error {
  display: none;
  font-size: 0.75rem;
  color: red;
  margin-top: 0.4em;
}

.field.invalid input,
.field.invalid textarea {
  border-bottom-color: red;
}

.field.invalid .field-error {
  display: block;
}

/* ===== SF2023 CONTENT ===== */
.sf-content {
  margin-bottom: 3em;
}

.sf-content p {
  margin-bottom: 1.2em;
  font-size: 0.95rem;
  line-height: 1.7;
}

.sf-content h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.8em;
}

.sf-sectors,
.sf-checklist {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1.4em;
}

.sf-sectors li,
.sf-checklist li {
  margin-bottom: 0.3em;
  font-size: 0.95rem;
  line-height: 1.7;
}

.sf-sectors li::before {
  content: "— ";
}

.sf-checklist li::before {
  content: "— ";
}

.sf-hint {
  font-style: italic;
}

/* SF2023 footer (image + projects) */
.sf-footer {
  margin-top: 4em;
  padding-top: 3em;
  border-top: 2px solid #000;
}

.sf-nkfih-img {
  display: block;
  max-width: 100%;
  width: 480px;
  margin: 0 auto 2.5em;
}

.sf-footer h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2em;
}

.sf-project {
  margin-bottom: 2.5em;
  padding-bottom: 2.5em;
  border-bottom: 1px solid #000;
}

.sf-project:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sf-project p {
  font-size: 0.85rem;
  line-height: 1.7;
  margin-bottom: 0.3em;
}

/* SF2023 documents */
.sf-documents {
  margin-top: 4em;
  padding-top: 3em;
  border-top: 2px solid #000;
}

.sf-documents h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.5em;
}

.sf-doc-list {
  list-style: none;
  padding-left: 0;
}

.sf-doc-list li {
  margin-bottom: 0.8em;
}

.sf-doc-list a {
  color: #000;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid #000;
  transition: border-color 0.2s;
}

.sf-doc-list a:hover {
  border-bottom-color: transparent;
}

.submit-btn {
  font-family: 'PT Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  background: #000;
  color: #fff;
  border: 2px solid #000;
  padding: 12px 40px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.submit-btn:hover {
  background: #fff;
  color: #000;
}

/* Success state */
.form-success {
  display: none;
  text-align: center;
  padding: 60px 0;
}

.form-success.visible {
  display: block;
}

.form-success p {
  font-size: 1rem;
  line-height: 1.7;
}

.apply-divider {
  margin-top: 2em;
  margin-bottom: 1.5em;
  border-top: 1px solid #000;
}

.apply-sf2023 {
  text-align: left;
  margin-bottom: 0;
}

/* ===== FADE-IN ANIMATION ===== */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.fade-in:nth-child(1) { transition-delay: 0s; }
.fade-in:nth-child(2) { transition-delay: 0.08s; }
.fade-in:nth-child(3) { transition-delay: 0.16s; }
.fade-in:nth-child(4) { transition-delay: 0.24s; }
.fade-in:nth-child(5) { transition-delay: 0.32s; }
.fade-in:nth-child(6) { transition-delay: 0.4s; }
.fade-in:nth-child(7) { transition-delay: 0.48s; }
.fade-in:nth-child(8) { transition-delay: 0.56s; }
.fade-in:nth-child(9) { transition-delay: 0.64s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .hero {
    padding: clamp(20px, 5vh, 40px) 20px;
    align-items: flex-start;
    min-height: auto;
  }

  .hero-content p {
    font-size: 0.95rem;
  }

  table {
    font-size: 0.78rem;
  }

  thead th,
  tbody td {
    padding-right: 12px;
  }

  .overlay {
    padding-top: 20px;
  }

  .overlay-inner {
    padding: 50px 24px 60px;
  }
}

