/* Foundations: edit these tokens to change the style across the whole site. */
:root {
  --bg: #1a1a1d;
  --surface: #222;
  --surface-raised: #2c2c31;
  --text: #fbfbfb;
  --muted: #fbfbfb99;
  --border: #555;
  --radius: 15px;
  --space: 20px;
  --font: "Inter", Helvetica, Arial, sans-serif;
  --heading-font: "Pangea", Helvetica, Arial, sans-serif;
  --shadow: 0 4px 12px rgb(0 0 0 / 25%);
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-padding-top: 100px; }
body {
  margin-top: 80px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 1rem 0; font-family: var(--heading-font); font-weight: 500; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
p { margin: 1rem 0; }
ul, ol { padding-left: 1.25rem; }
hr { margin: 1rem 0; border: 0; border-top: 1px solid var(--border); }
:focus-visible { outline: 3px solid #9fe7ff; outline-offset: 3px; }

/* Shared layout and components. Page rules below only arrange their content. */
.container { width: 90%; max-width: 1700px; margin: 0 auto; }
.page-container { width: 92%; max-width: 1100px; margin: 0 auto; padding: 24px 0 40px; }
.stack { display: flex; flex-direction: column; gap: var(--space); }
.card {
  min-width: 0;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card img { border-radius: var(--radius); }
.muted { color: var(--muted); }
.small, .summary-right { color: var(--muted); font-size: .95rem; }
.text-center { text-align: center; }
.button-group, .toolbar { display: flex; flex-wrap: wrap; gap: .5rem; }
.button-group { justify-content: center; margin: 1rem 0; }
.toolbar { justify-content: flex-end; margin-bottom: .5rem; }
button, .button, .btn, .dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 10px 20px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font: 500 1rem var(--font);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .2s, color .2s;
}
button:hover, .button:hover, .btn:hover, .dl-btn:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.btn-dark { background: transparent; color: var(--text); }
.btn-dark:hover { background: var(--text); color: var(--bg); }
.btn-large { flex-shrink: 0; padding: 20px 36px; font-size: 18px; line-height: 18px; }
input, select, textarea {
  max-width: 100%;
  min-width: 0;
  padding: .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #111;
  color: var(--text);
  font: inherit;
  touch-action: manipulation;
}
input[type="range"] { padding: 0; }
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.form-row input:not([type="checkbox"]) { flex: 1; }
.table-scroll, .board-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
table { border-collapse: collapse; }
.table-scroll table { width: 100%; min-width: 620px; }
.table-scroll th, .table-scroll td { padding: .5rem; border: 1px solid var(--border); }
.grid, .two-col { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.two-col { margin-top: 1rem; }
.badge {
  padding: .2rem .6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  white-space: nowrap;
}
details { padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
.details-body { margin-top: .9rem; }
.details-body li { margin: .25rem 0; }
pre {
  max-width: 100%;
  margin-top: .7rem;
  padding: .9rem;
  overflow-x: auto;
  background: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.spacer { height: .8rem; }
.space-top { margin-top: 1rem; }

/* Navigation and account dialogs. */
.site-header { position: fixed; inset: 0 0 auto; z-index: 2000; padding: 15px 24px; background: var(--bg); }
.site-header .header-content { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.nav-left { flex-shrink: 0; }
.nav-left a { margin-right: 30px; }
.logo { font-weight: bold; }
.nav-right { display: flex; align-items: center; gap: 15px; min-width: 0; }
#who {
  max-width: 200px;
  margin-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.dropdown { position: relative; }
.burger { padding: 5px 11px; font-size: 22px; }
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  padding: 10px 0;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dropdown-content a { display: flex; align-items: center; padding: 10px 20px; font-size: .95rem; }
.dropdown-content a:hover { background: #eee; }
.dropdown.is-open .dropdown-content { display: block; }
.mobile-nav { display: none !important; }
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(0 0 0 / 50%);
}
.modal.show { display: flex; }
.modal-content {
  position: relative;
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.modal-close { position: absolute; top: .5rem; right: .75rem; font-size: 1.5rem; cursor: pointer; }
.modal input { display: block; width: 100%; margin: .5rem 0; }
.modal button { width: 100%; margin-top: 1rem; }
.error { margin-top: .5rem; color: #ff7070; font-size: .85rem; }

/* Portfolio composition: preserve the existing hero, sections, and contact panel. */
.home-page { margin-top: 20px; }
.portfolio { display: flex; flex-direction: column; min-height: 100vh; }
.portfolio .container { width: 100%; padding: 0 20px; }
.portfolio { font-family: "Inter-Regular", Helvetica, sans-serif; }
.portfolio-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 40px;
  width: 100%;
  margin: 80px auto 0;
  padding: 0 10px;
}
.hero { margin-top: 60px; gap: 60px; }
.hero-layout { display: flex; align-items: center; justify-content: space-between; gap: 40px; width: 100%; }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 60px; width: 560px; }
.hero-intro { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; width: 100%; }
.hero-portrait { display: flex; flex-direction: column; align-items: flex-end; gap: 70px; min-width: 455px; }
.portrait { width: 233px; height: 285px; object-fit: cover; border-radius: var(--radius); }
.hero-title {
  align-self: stretch;
  font-family: "Inter-Medium", Helvetica, sans-serif;
  font-size: 80px;
  font-weight: 500;
  line-height: 92px;
  letter-spacing: -2.4px;
  text-align: right;
}
.hero-name { text-align: left; }
.section-title { align-self: stretch; }
.portfolio-copy {
  align-self: stretch;
  margin-top: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 27px;
  letter-spacing: -.54px;
}
.section-title, .contact-title {
  margin-top: -1px;
  font-family: "Inter-Medium", Helvetica, sans-serif;
  font-size: 68px;
  font-weight: 500;
  line-height: 78.2px;
  letter-spacing: -2.04px;
}
.portfolio-columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  width: 100%;
}
.education, .languages {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 555px;
  max-width: 800px;
}
.education { align-self: stretch; gap: 30px; width: 694px; }
.languages { gap: 20px; }
.portfolio-detail { display: flex; flex-direction: column; align-items: flex-start; gap: 15px; width: 100%; }
.portfolio-heading {
  align-self: stretch;
  margin-top: -1px;
  font-family: "Inter-Medium", Helvetica, sans-serif;
  font-size: 34px;
  font-weight: 500;
  line-height: 51px;
  letter-spacing: -1.02px;
}
.education-title { width: 461px; }
.skill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; }
.skill-label, .button-label { margin-top: -1px; }
.portfolio-detail > .skill-row:last-child { align-self: stretch; width: 100%; }
.skill {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  font-size: 18px;
  line-height: 27px;
  letter-spacing: -.54px;
  white-space: nowrap;
}
.projects-intro, .project-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 300px;
}
.projects-intro { align-self: stretch; justify-content: space-between; }
.projects-intro .portfolio-copy { max-width: 560px; margin-top: -1px; }
.project-list { gap: 20px; }
.project-entry { display: flex; flex-direction: column; align-items: flex-end; gap: 15px; width: 100%; }
.project-row { display: flex; align-items: flex-end; justify-content: space-between; width: 100%; }
.project-description { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 440px; }
.project-link {
  font: 500 18px/27px "Inter-Medium", Helvetica, sans-serif;
  letter-spacing: -.54px;
  white-space: nowrap;
}
.divider { width: 100%; margin: 15px 0 0; border-top-color: #444; }
.portfolio .btn-large { font-family: "Inter-Regular", Helvetica, sans-serif; letter-spacing: -.54px; }
.contact {
  width: 100%;
  margin-top: 80px;
  padding: 20px;
  background: var(--text);
  color: var(--bg);
  border-radius: 45px 45px 0 0;
}
.contact-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 100px;
  width: 100%;
  padding-top: 60px;
}
.contact-layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 0 20px;
}
.contact-title, .contact-copy { flex: 1; min-width: 300px; max-width: 800px; }
.contact-title { margin-top: 0; white-space: nowrap; }
.contact-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.contact .btn-dark { background: var(--bg); color: var(--text); border-color: var(--bg); }
.contact .btn-dark:hover { background: transparent; color: var(--bg); }
.contact-copy .portfolio-copy { margin-top: -1px; color: #1b1b1d99; }
.contact-email {
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 0 20px;
  opacity: .5;
  font: 500 clamp(40px, 9vw, 120px)/1.2 "Inter-Medium", Helvetica, sans-serif;
  letter-spacing: -3.92px;
}
.linebreak-lg { display: none; }

/* IoT widgets: graph sizing and light switches. */
.dashboard { display: flex; flex-direction: column; gap: 2rem; padding: 0 1rem; }
.row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 2rem; }
.graph-card { display: flex; flex-direction: column; height: 45vh; }
.graph-card canvas { width: 100%; height: 100%; min-height: 0; padding-bottom: 3em; }
#lightForm { margin-bottom: 1rem; gap: 1rem; }
.checkbox-container { display: flex; align-items: center; margin-right: 10px; }
.checkbox-container input {
  appearance: none;
  position: relative;
  width: 60px;
  height: 30px;
  margin: 10px 0;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #404040;
  cursor: pointer;
}
.checkbox-container input::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-size: 12px;
  pointer-events: none;
}
#red:checked { background: red; }
#yellow:checked { background: yellow; }
#yellow:checked::after { color: black; }
#green:checked { background: green; }
.camera-stream { background: black; }
.accordion { margin-top: 2rem; }
.accordion-item {
  margin-bottom: 1rem;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.accordion-header {
  width: 100%;
  justify-content: flex-start;
  padding: 1rem;
  border: 0;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 1.1rem;
}
.accordion-header:hover { background: #3a3a40; }
.accordion-content { display: none; padding: 1rem; overflow-wrap: anywhere; }
.accordion-item.active .accordion-content { display: block; }

/* Local game and download layouts; colors and controls inherit the shared theme. */
.sudoku-wrapper { display: flex; justify-content: center; gap: 2rem; margin-top: 2rem; }
.sudoku-grid { margin: 0 auto; }
.sudoku-grid td { width: 40px; height: 40px; border: 1px solid #999; text-align: center; font-size: 1.2rem; }
.sudoku-grid .fixed { background: #333; font-weight: bold; }
.sudoku-grid .solved { color: #4ade80; }
.board-scroll { padding: 0 12px; }
#board { display: grid; grid-template-columns: repeat(20, 30px); gap: 1px; width: fit-content; margin: 20px auto; }
#board .cell {
  width: 30px;
  height: 30px;
  border: 1px solid #888;
  background: #bbb;
  font: bold 16px/30px monospace;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
#board .revealed { background: #ddd; cursor: default; }
#board .flagged { background: #f88; color: black; }
#info-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1rem; }
.board-hint { font-size: .9rem; }
.game-content { margin-top: 2rem; text-align: center; }
.binary-search .card { margin-bottom: 2rem; }
#toggleHeader { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.arrow { font-size: 1.2rem; transition: transform .3s; }
.open .arrow { transform: rotate(180deg); }
.explanation-content { display: none; }
.explanation-content.open { display: block; padding-top: 1rem; }
#bike img { display: block; max-width: 200px; margin: 1rem auto; }
.inputs { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.inputs > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.inputs input[type="range"] { width: 80%; }
.guess-card { text-align: center; }
.guess-card input { width: 150px; }
.platform-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .8rem;
}
.downloads { display: flex; flex-direction: column; gap: .75rem; margin-top: .75rem; }

/* Archived tools also use the shared theme, with only their widget geometry here. */
.legacy-page { padding: 0 16px 24px; }
.blog-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 12px;
  background: var(--surface);
}
.blog-header .logo-img { width: 70px; border-radius: 50%; }
.dropbtn {
  width: 44px;
  height: 44px;
  background-image: url('/Icons/Menu.png');
  background-position: center;
  background-size: 25px;
  background-repeat: no-repeat;
}
.auth { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-left: auto; }
.linkBox { display: block; width: min(100%, 760px); margin: 15px auto; }
.download_container {
  width: min(100%, 600px);
  padding: var(--space);
  background: var(--surface);
  border-radius: var(--radius);
}
.vending-machine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: min(100%, 600px);
  margin: 20px auto;
  padding: var(--space);
  background: var(--surface);
  border-radius: var(--radius);
}
.vending-machine > div { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.vending-machine .textDisplay { font-size: 2rem; }
.etch-page .bigBox { background: #404040; }

/* Breakpoints live next to each other instead of overriding several page files. */
@media (hover: hover) {
  .dropdown:hover .dropdown-content { display: block; }
}
@media (min-width: 1200px) {
  .linebreak-lg { display: inline; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .hero-layout { flex-direction: column; align-items: stretch; gap: 32px; }
  .hero-copy { width: 100%; gap: 28px; }
  .hero-portrait { width: 100%; min-width: 0; align-items: center; gap: 24px; }
  .hero-portrait .hero-title { text-align: center; }
  .education, .languages { width: 100%; min-width: 0; max-width: none; flex-basis: 100%; }
  .project-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .project-description { width: 100%; }
  .contact-layout { flex-direction: column; }
}
@media (max-width: 900px) {
  .row { grid-template-columns: minmax(0, 1fr); }
  .sudoku-wrapper { flex-direction: column; align-items: center; }
}
@media (max-width: 812px) {
  .naver { display: none; }
  .mobile-nav { display: flex !important; }
}
@media (max-width: 600px) {
  body { margin-top: 84px; }
  input, select, textarea { font-size: 16px; }
  button, .button, .btn, .dl-btn { min-height: 44px; }
  .card { padding: 16px; }
  .site-header { padding: 12px; }
  .header-content { gap: 8px; }
  .nav-right { gap: 6px; }
  .nav-left .logo { margin-right: 0; }
  #who { display: none; }
  #registerBtn, #loginBtn, #logoutBtn { padding: 8px 10px; font-size: .875rem; }
  .burger { width: 44px; padding: 6px; }
  .dropdown-content {
    width: min(280px, calc(100vw - 24px));
    min-width: 0;
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
  }
  .dropdown-content a { min-height: 44px; }
  .modal-content { padding: 24px 20px; }
  .home-page { margin-top: 84px; }
  .portfolio .container { padding: 0 16px; }
  .portfolio-section { margin-top: 32px; padding: 0; gap: 24px; }
  .hero-layout { text-align: center; }
  .hero-title { font-size: clamp(36px, 10vw, 60px); line-height: 1.15; letter-spacing: -1px; }
  .section-title, .contact-title {
    font-size: clamp(30px, 8vw, 44px);
    line-height: 1.2;
    letter-spacing: -1px;
    text-align: left;
  }
  .portfolio-heading { width: 100%; font-size: 26px; line-height: 1.3; }
  .projects-intro, .project-list, .contact-title, .contact-copy { min-width: 0; width: 100%; flex-basis: 100%; }
  .skill-row { gap: 8px; }
  .skill { padding: 8px 12px; font-size: 16px; }
  .btn-large { max-width: 100%; padding: 16px 20px; line-height: 1.4; white-space: normal; }
  .portrait { width: 180px; height: auto; }
  .contact { margin-top: 24px; padding: 24px 16px; border-radius: 24px 24px 0 0; }
  .contact-inner { padding-top: 0; gap: 24px; }
  .contact-layout { padding: 0; gap: 16px; }
  .contact-email { padding: 0; font-size: clamp(18px, 5vw, 30px); letter-spacing: -.5px; overflow-wrap: anywhere; }
  .dashboard { padding: 0 12px; gap: 16px; }
  .row { gap: 16px; }
  .graph-card { height: 320px; }
  .graph-card h3 { font-size: 1.1rem; }
  .form-row:not(#lightForm) { flex-direction: column; align-items: stretch; }
  .form-row input { width: 100%; min-height: 44px; }
  .checkbox-container input { height: 44px; }
  .sudoku-wrapper { gap: 24px; }
  .sudoku-grid { width: 100%; max-width: 360px; table-layout: fixed; }
  .sudoku-grid td { width: auto; height: clamp(28px, 9vw, 40px); font-size: 1rem; }
  .inputs input[type="range"] { width: 100%; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
