@font-face {
  font-family: 'DarkerGrotesque';
  src: url('DarkerGrotesque-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

html,
body {
  width: 100%;
  min-height: 100%;
  background: #2d2d2d;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

#site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

#logo {
  width: 140px;
  height: auto;
}

#site-nav {
  display: flex;
  gap: 40px;
}

.nav-link {
  font-family: 'DarkerGrotesque', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #666;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover {
  color: #aaa;
}

.nav-link.nav-active {
  color: #E2E2E2;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

#game-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 48px;
  padding: 8px 40px 48px;
  max-width: 1400px;
  margin: 0 auto;
  margin-top: 30px;
}

/* ── Clue panel ──────────────────────────────────────────────────────────── */

#clue-panel {
  flex: 1;
  min-width: 0;
  color: #E2E2E2;
  font-family: 'DarkerGrotesque', sans-serif;
}

#active-clue,
#well-done {
  font-family: 'DarkerGrotesque', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background: #2a2a2a;
  padding: 6px 12px 8px 12px;
  line-height: 1.4;
  border-radius: 8px;
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  border: 3px solid black;
}

#active-clue-text:empty::before {
  content: 'Select a clue to begin';
  opacity: 0.5;
  font-weight: 400;
}

#active-clue-text {
  flex: 1;
}

#active-clue-num {
  font-weight: 800;
  margin-right: 6px;
  opacity: 0.8;
}

#well-done {
  background: #2d7731;
  letter-spacing: 1px;
}

#clues-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

#clue-panel h3 {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-transform: uppercase;
  color: #999;
  padding: 5px 8px;
  margin-bottom: 10px;
  display: block;
  transition: background 0.1s, color 0.1s;
}

#clues-across.dir-active h3,
#clues-down.dir-active h3 {
  background: #c0392b;
  color: #fff;
}

#clue-panel ul {
  list-style: none;
}

#clue-panel li {
  font-size: 0.88rem;
  padding: 4px 8px;
  cursor: pointer;
  color: #e3e3e3;
  line-height: 1.35;
  border-radius: 2px;
  transition: all 0.1s;
  letter-spacing: 1px;
}

#clue-panel li:hover {
  color: #bbb;
}

#clue-panel li.clue-active {
  background: #e8aaaa;
  color: #000;
  font-weight: 600;
}

/* ── Grid area ───────────────────────────────────────────────────────────── */

#grid-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* ── Crossword grid ──────────────────────────────────────────────────────── */

#crossword-grid {
  display: grid;
  gap: 3px;
  flex-shrink: 0;
  grid-template-columns: repeat(14, minmax(0, 46px));
  background: black;
  border: 3px solid black;
  border-radius: 8px;
  overflow: hidden;
}

.cell {
  width: auto;
  height: auto;
  aspect-ratio: 1;
  position: relative;
}

.cell-black {
  background: #2a2a2a;
}

.cell-letter {
  background: #E2E2E2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  container-type: inline-size;
  border-radius: 10%;
}

.cell-letter .num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-family: 'DarkerGrotesque', sans-serif;
  font-size: 29cqw;
  font-weight: 700;
  color: #555;
  line-height: 1;
}

.cell-letter .letter {
  font-family: 'DarkerGrotesque', sans-serif;
  font-weight: 800;
  font-size: 70cqw;
  color: #222222;
  line-height: 0;
  text-transform: uppercase;
  padding-bottom: 7cqw;
}

/* Separator cell */
.cell-separator {
  background: #888;
  cursor: default;
  pointer-events: none;
}

/* Selection states */
.cell-letter.word-hl {
  background: #e8aaaa;
}

.cell-letter.cell-cur {
  background: #c0392b;
}

.cell-letter.cell-cur .letter {
  color: #fff;
}

.cell-letter.cell-cur .num {
  color: rgba(255, 255, 255, 0.6);
}

.cell-letter.correct {
  background: #a8d5a2;
}

/* ── Panel action buttons ─────────────────────────────────────────────────── */

#panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  justify-content: flex-end;
}

#clue-nav {
  display: none;
}

#solve-btn {
  font-family: 'DarkerGrotesque', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #555;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: color 0.15s;
}

#solve-btn:hover {
  color: #999;
}

#reset-btn {
  font-family: 'DarkerGrotesque', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #222222;
  background: #E2E2E2;
  border: none;
  padding: 0.45rem 1.2rem;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 3px;
  transition: background 0.15s ease;
}

#reset-btn:hover {
  background: #ffffff;
}

/* ── Mobile keyboard input ───────────────────────────────────────────────── */

#mobile-input {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px; /* prevent iOS zoom */
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */

@media only screen and (max-width: 900px) {
  #site-header {
    padding: 16px 20px;
  }

  #game-container {
    flex-direction: column-reverse;
    padding: 16px 20px 40px;
    gap: 28px;
    margin-top: 0px;
  }

  #grid-area {
    align-items: center;
    align-self: center;
  }

}

@media only screen and (max-width: 600px) {
  #site-header {
    padding: 16px 20px;
    flex-direction: column;
    margin-top: 12px;
    gap: 18px;
  }

  #active-clue {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 72px;
    z-index: 100;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  #clue-nav {
    display: flex;
    flex-shrink: 0;
    gap: 6px;
    visibility: hidden;
  }

  #clue-nav button {
    font-family: 'DarkerGrotesque', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    background: rgba(255,255,255,0.15);
    border: none;
    padding: 0.2rem 0.7rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
  }
}

/* ── Page sections (About Me / Contact) ──────────────────────────────────── */

.page-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 40px 80px;
  color: #E2E2E2;
  font-family: 'DarkerGrotesque', sans-serif;
}

.page-section h2 {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 24px;
  margin-top: 56px;
}

.page-section h2:first-child {
  margin-top: 0;
}

/* ── About — intro ───────────────────────────────────────────────────────── */

.about-intro {
  font-size: 1.25rem;
  line-height: 1.65;
  color: #c8c8c8;
  max-width: 720px;
  margin-bottom: 64px;
}

/* ── About — timeline ────────────────────────────────────────────────────── */

.timeline {
  border-left: 2px solid #c0392b;
  display: flex;
  flex-direction: column;
  gap: 36px;
  margin-bottom: 24px;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #c0392b;
  flex-shrink: 0;
  left: -6px;
}

.timeline-content {
  padding-left: 20px;
}

.timeline-period {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #666;
  display: block;
  margin-bottom: 4px;
}

.timeline-role {
  font-size: 1.1rem;
  font-weight: 700;
  color: #E2E2E2;
  margin: 0 0 2px;
}

.timeline-company {
  font-size: 0.95rem;
  font-weight: 600;
  color: #c0392b;
  margin: 0;
}

/* ── About — education ───────────────────────────────────────────────────── */

.edu-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.edu-item {
  border-left: 2px solid #3a3a3a;
  padding-left: 20px;
}

.edu-name {
  font-size: 1rem;
  font-weight: 700;
  color: #E2E2E2;
  margin: 0 0 2px;
}

.edu-detail {
  font-size: 0.9rem;
  color: #999;
  margin: 0 0 2px;
}

.edu-period {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #868686;
}

/* ── Contact ─────────────────────────────────────────────────────────────── */

.contact-inner {
  max-width: 480px;
}

.contact-inner h2 {
  margin-top: 0;
}

.contact-tagline {
  font-size: 1.15rem;
  color: #999;
  margin-bottom: 40px;
  line-height: 1.5;
}

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.contact-list li {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid #3a3a3a;
}

.contact-list li:first-child {
  border-top: 1px solid #3a3a3a;
}

.contact-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #868686;
  min-width: 80px;
  flex-shrink: 0;
}

.contact-value {
  font-size: 1rem;
  font-weight: 600;
  color: #E2E2E2;
  text-decoration: none;
  transition: color 0.15s;
}

.underline {
  text-decoration: underline;
}

a.contact-value:hover {
  color: #c0392b;
}

/* ── Responsive — sections ───────────────────────────────────────────────── */

@media only screen and (max-width: 900px) {
  .page-section {
    padding: 28px 20px 60px;
  }

  .about-intro {
    font-size: 1.1rem;
    margin-bottom: 48px;
  }
}

