/* ============================================================
   MI. — Portfolio
   Theme: GitHub-dark "code editor"
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg-base:      #010409;
  --bg-panel:     #0d1117;
  --bg-elevated:  #161b22;
  --bg-hover:     #1c2333;
  --border:       #21262d;
  --border-strong:#30363d;

  --text:         #e6edf3;
  --text-muted:   #c9d1d9;
  --text-dim:     #8b949e;
  --text-faint:   #7d8590;
  --text-fainter: #6e7681;
  --line-no:      #484f58;

  --accent:       #58a6ff;
  --accent-soft:  rgba(56, 139, 253, 0.12);
  --green:        #3fb950;
  --green-btn:    #238636;
  --green-btn-hi: #2ea043;
  --comment:      #6a9955;

  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --radius:    6px;
  --radius-lg: 8px;
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
}

body {
  font-family: var(--font-mono);
  color: var(--text);
}

a { color: inherit; }

h1, h2, h3 { margin: 0; font-size: inherit; font-weight: inherit; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

::selection { background: rgba(56, 139, 253, 0.30); color: var(--text); }

/* ---------- Accessibility helpers ---------- */
.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;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 1000;
  padding: 9px 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #010409;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

/* Visible keyboard focus ring */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: var(--bg-panel); }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 2px solid var(--bg-panel);
}
*::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ---------- Animations ---------- */
@keyframes wpulse {
  0%   { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.pulse { animation: wpulse 1.9s infinite; }

/* Blinking cursors */
.cursor-block {
  display: inline-block;
  width: 9px;
  height: 0.78em;
  background: var(--accent);
  vertical-align: -2px;
  margin-left: 6px;
  animation: blink 1.1s step-end infinite;
}
.cursor-caret {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--accent);
  vertical-align: -2px;
  margin-left: 4px;
  animation: blink 1.1s step-end infinite;
}

/* ---------- App shell ---------- */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

/* ---------- Title bar ---------- */
.titlebar {
  flex: none;
  display: flex;
  align-items: center;
  height: 40px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
}
.window-dots { display: flex; gap: 8px; }
.window-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot--red    { background: #ff5f56; }
.dot--yellow { background: #ffbd2e; }
.dot--green  { background: #27c93f; }

.titlebar__title {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
}
.titlebar__title .path { color: var(--line-no); }
.titlebar__spacer { width: 60px; }

/* ---------- Main row ---------- */
.main {
  flex: 1;
  min-height: 0;
  display: flex;
}

/* ---------- Explorer ---------- */
.explorer {
  flex: none;
  width: 240px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.explorer__label {
  padding: 12px 14px 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}
.explorer__root {
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.explorer__root .chevron { color: var(--text-faint); }
.explorer__files {
  padding: 4px 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.explorer__spacer { flex: 1; }
.explorer__status {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
}
.explorer__status .row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.explorer__status .sub { margin-top: 6px; color: var(--text-fainter); }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}

/* File icon swatches (shared by tree + tabs) */
.ic {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}
.ic--js   { background: #f1e05a; }
.ic--md   { background: #519aba; }
.ic--json { background: #cbcb41; }
.ic--sh   { background: #89e051; }
.ic--txt  { background: #8b949e; }

/* Tree items */
.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12.5px;
  border-radius: 5px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  width: 100%;
}
.tree-item:hover { color: var(--text); }
.tree-item.is-active {
  box-shadow: inset 2px 0 0 var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

/* ---------- Editor ---------- */
.editor {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Tab strip */
.tabs {
  flex: none;
  display: flex;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  border-top: 2px solid transparent;
  background: var(--bg-base);
  color: var(--text-faint);
  font-family: inherit;
  text-decoration: none;
}
.tab.is-active {
  border-top-color: var(--accent);
  background: var(--bg-panel);
  color: var(--text);
}

/* Scroll body */
.editor-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  background: var(--bg-panel);
  scroll-behavior: smooth;
}

/* ---------- Generic file section ---------- */
.file {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: clamp(40px, 6vh, 60px) clamp(20px, 4vw, 52px);
  scroll-margin-top: 8px;
}
.file:first-child { border-top: none; }

.section__comment {
  font-size: 12.5px;
  color: var(--comment);
  margin-bottom: 14px;
}
.section__title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.section__title .md { color: var(--comment); }
.section__meta {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 28px;
}

/* ---------- Hero ---------- */
.hero { padding: 46px clamp(20px, 4vw, 52px) 56px; }
.hero__inner { max-width: 900px; }

.code-line {
  display: flex;
  align-items: flex-start;
}
.code-line .line-no {
  flex: none;
  width: 46px;
  text-align: right;
  padding-right: 18px;
  color: var(--line-no);
  font-size: 14px;
  line-height: 2;
  user-select: none;
}
.code-line .line-body {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 2;
  white-space: pre-wrap;
}
.code-line.is-blank .line-body { line-height: 2; }

.code-line.hero__title {
  margin: 10px 0;
}
.code-line.hero__title .line-no {
  line-height: 1.18;
  padding-top: 12px;
}
.code-line.hero__title .line-body {
  font-size: clamp(30px, 4.6vw, 48px);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.code-line.hero__comment .line-no { line-height: 1.95; }
.code-line.hero__comment .line-body {
  font-size: 15.5px;
  line-height: 1.95;
}

.comment { color: var(--comment); }
.prose    { color: #adbac7; }
.keyword  { color: var(--accent); }

.dot-inline {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-left: 9px;
  vertical-align: middle;
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 30px 0 0 46px;
}

/* ---------- Buttons ---------- */
.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn .arrow { font-size: 15px; }
.btn--primary {
  background: var(--green-btn);
  color: #fff;
  border: 1px solid rgba(240, 246, 252, 0.1);
}
.btn--primary:hover { background: var(--green-btn-hi); }
.btn--secondary {
  background: var(--border);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.btn--secondary:hover { background: var(--border-strong); border-color: var(--text-dim); }
.btn--lg { padding: 11px 20px; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.skill-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all 0.16s ease;
}
.skill-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.skill-card__head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 11px;
}
.skill-card__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.skill-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.skill-card__desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
  margin: 0;
}

/* ---------- Layout helper ---------- */
.wrap { max-width: 1000px; margin: 0 auto; }
.wrap--narrow { max-width: 840px; }
.wrap--tight  { max-width: 720px; }

/* ---------- Projects ---------- */
.repo-list {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-panel);
}
.repo {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.repo:last-child { border-bottom: none; }
.repo__head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.repo__name {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}
.repo__name:hover { text-decoration: underline; }

.badge {
  font-size: 10.5px;
  padding: 1px 8px;
  border-radius: 999px;
}
.badge--public {
  border: 1px solid var(--border-strong);
  color: var(--text-faint);
}
.badge--category {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
}

.repo__desc {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.55;
  margin: 9px 0 13px;
  max-width: 74ch;
}

.tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}
.tag {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.repo__meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.repo__lang {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lang-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.lang-dot--wp { background: #21759b; }
.lang-dot--js { background: #f1e05a; }
.repo__url { color: var(--text-fainter); }
.repo__visit {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.15s ease;
}
.repo__visit:hover { transform: translateX(3px); }

/* ---------- Terminal (process + contact) ---------- */
.terminal {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.terminal__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-strong);
}
.terminal__bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.terminal__name {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.terminal__body {
  padding: 22px;
  font-size: 13.5px;
  line-height: 1.7;
  background: var(--bg-base);
}

.prompt   { color: var(--green); }
.flag     { color: #a5d6ff; }
.cmd      { color: var(--text); }
.step-id  { color: #79c0ff; }
.step-name { color: var(--text); font-weight: 600; }

.step { margin-bottom: 16px; }
.step__comment {
  color: var(--comment);
  padding-left: 30px;
}
.term-line--cmd { margin-bottom: 18px; }
.term-done { color: var(--text-dim); }
.term-next { margin-top: 4px; }

/* ---------- Contact ---------- */
.contact-card {
  padding: clamp(30px, 5vw, 46px);
  text-align: center;
  background: var(--bg-base);
}
.contact__cmd {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.contact__title {
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 12px;
}
.contact__desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-dim);
  max-width: 48ch;
  margin: 0 auto 28px;
}
.contact__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.footer {
  padding: 26px 4px 8px;
  color: var(--comment);
  font-size: 12px;
}

/* ---------- Status bar ---------- */
.statusbar {
  flex: none;
  display: flex;
  align-items: center;
  height: 25px;
  background: #1f6feb;
  color: #fff;
  font-size: 11.5px;
  overflow: hidden;
}
.statusbar__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  height: 100%;
}
.statusbar__item--hl { background: rgba(255, 255, 255, 0.10); }
.statusbar__spacer { flex: 1; }
.statusbar__meta { padding: 0 11px; opacity: 0.92; }
.statusbar__meta--hl {
  background: rgba(255, 255, 255, 0.10);
  height: 100%;
  display: flex;
  align-items: center;
}
.statusbar .ring {
  width: 8px;
  height: 8px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  display: inline-block;
}
.statusbar .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #56d364;
  display: inline-block;
}

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .explorer { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .editor-scroll { scroll-behavior: auto; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 0.5cm; }
  html, body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
