/* ==========================================================================
   emerics.com — Clean Architectural Layout & Embedded Shell
   ========================================================================== */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Monaco, Consolas, monospace;

  --surface: #F9F9F7;
  --surface-low: #F4F4F2;
  --surface-highest: #E2E3E1;
  --surface-card: #FFFFFF;

  --ink: #1A1C1B;
  --ink-variant: #45474B;
  --outline: #76777B;
  --hairline: #E2E3E1;

  --obsidian: #0C0E12;
  --obsidian-bar: #1A1C20;
  --obsidian-ink: #F1F1EF;

  --emerald: #006C49;
  --emerald-bright: #4EDEA3;
  --vermilion: #BA1A1A;

  --shadow-terminal: 0 24px 60px rgba(12, 14, 18, 0.16);
  --shadow-card: 0 1px 2px rgba(12, 14, 18, 0.04);
}

[data-theme="dark"] {
  --surface: #0C0E12;
  --surface-low: #13161C;
  --surface-highest: #252A34;
  --surface-card: #12151B;

  --ink: #F1F1EF;
  --ink-variant: #A7ACB6;
  --outline: #79808C;
  --hairline: #232833;

  --obsidian: #07090C;
  --obsidian-bar: #12151C;
  --obsidian-ink: #F1F1EF;

  --emerald: #4EDEA3;
  --emerald-bright: #4EDEA3;

  --shadow-terminal: 0 24px 70px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}

body.shell-sheet-open {
  overflow: hidden;
}

h1,
h2,
strong {
  color: var(--ink);
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

.hideme {
  display: none;
}

/* ==========================================================================
   Top Bar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1280px;
  height: 58px;
  margin: 0 auto;
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sq-pulse {
  width: 6px;
  height: 6px;
  background: var(--emerald);
  display: inline-block;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-variant);
}

.topbar-links a:hover,
.topbar-link-btn:hover {
  color: var(--ink);
}

.topbar-sep {
  color: var(--hairline);
}

.topbar-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-variant);
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
}

.theme-toggle:hover {
  border-color: var(--ink);
}

/* ==========================================================================
   Main Container & 12-Column Desktop Split
   ========================================================================== */

.main-wrap {
  max-width: 1280px;
  min-height: calc(100dvh - 59px);
  margin: 0 auto;
  padding: 2rem 2.5rem 1.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

.tectonic-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 3rem;
  align-items: center;
  margin: auto 0;
}

.identity-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 3.35rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero-sub {
  margin: 0.4rem 0 1.45rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: var(--ink-variant);
}

/* Profile Card (Portrait + 4 Clean Credential Rows) */
.specimen-card {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 1.25rem;
  padding: 1rem;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.45rem;
  align-items: center;
}

.specimen-photo-box {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-highest);
}

.specimen-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 20%;
  filter: grayscale(100%) contrast(1.1);
  transition: filter 320ms ease;
}

.specimen-photo-box:hover .specimen-photo {
  filter: grayscale(0%) contrast(1);
}

.specimen-meta-col {
  display: flex;
  flex-direction: column;
}

.specimen-kv {
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
}

.specimen-kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.85rem;
  padding-bottom: 0.52rem;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.78rem;
  color: var(--ink-variant);
}

.specimen-kv-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.specimen-kv-row > span:first-child {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--outline);
  flex-shrink: 0;
}

.specimen-kv-row strong,
.specimen-kv-row > span:last-child {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
}

.specimen-kv-row a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.specimen-kv-row a:hover {
  color: var(--emerald);
}

/* Editorial Bio */
.bio {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-width: 60ch;
  font-size: 0.96rem;
  line-height: 1.62;
  color: var(--ink-variant);
  margin-bottom: 1.45rem;
}

.bio p {
  margin: 0;
}

.bio strong {
  font-weight: 600;
  color: var(--ink);
}

.bio a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--emerald);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

/* Sharp Action Slabs (Desktop) */
.desktop-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.slab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.64rem 1.05rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  color: var(--ink);
}

.slab-btn:hover {
  border-color: var(--ink);
  background: var(--surface-low);
}

.slab-btn--obsidian {
  background: var(--obsidian);
  color: var(--obsidian-ink);
  border-color: var(--obsidian);
}

.slab-btn--obsidian:hover {
  background: var(--obsidian-bar);
  border-color: var(--emerald-bright);
  color: #FFFFFF;
}

[data-theme="dark"] .slab-btn--obsidian {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

[data-theme="dark"] .slab-btn--obsidian:hover {
  background: var(--emerald-bright);
  border-color: var(--emerald-bright);
  color: #0C0E12;
}

/* Mobile Dock (Hidden on Desktop) */
.mobile-dock {
  display: none;
}

/* ==========================================================================
   Right Column: Embedded Live Unix Shell
   ========================================================================== */

.shell-backdrop {
  display: none;
}

.shell-panel {
  height: 550px;
  display: flex;
  flex-direction: column;
  background: #080A0D;
  color: #E2E2E8;
  color-scheme: dark;
  border: 1px solid #1F242D;
  border-radius: 12px;
  box-shadow: var(--shadow-terminal);
  overflow: hidden;
}

.term-toolbar {
  height: 40px;
  padding: 0 1rem;
  background: #14171D;
  border-bottom: 1px solid #1F242D;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  flex-shrink: 0;
}

.term-lights {
  display: flex;
  gap: 6px;
}

.term-light {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.term-light--red { background: #BA1A1A; }
.term-light--amber { background: #76777B; }
.term-light--emerald { background: #006C49; }

.term-title {
  color: #C6C6CC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term-hint {
  color: #76777B;
  font-size: 0.64rem;
  white-space: nowrap;
}

.term-done {
  display: none;
  border: 1px solid #303642;
  background: #1F242D;
  color: #F1F1EF;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.term-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.42rem 0.72rem;
  background: #14171D;
  border-bottom: 1px solid #1F242D;
  flex-shrink: 0;
}

.term-chip {
  border: 0;
  background: #22262E;
  color: #E2E2E8;
  padding: 0.14rem 0.32rem;
  font-family: var(--font-mono);
  font-size: 0.59rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.term-chip:hover {
  background: #006C49;
  color: #FFFFFF;
}

.term-chip--clear {
  margin-left: auto;
  color: #8A8E96;
}

.term-chip--clear:hover {
  background: #BA1A1A;
  color: #FFFFFF;
}

.term-output {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.56;
  cursor: text;
}

.term-banner {
  color: #828691;
  font-size: 0.7rem;
  margin-bottom: 0.9rem;
}

.term-block {
  margin-bottom: 0.9rem;
}

.term-cmd-echo {
  margin-bottom: 0.35rem;
}

.term-emerald {
  color: #4EDEA3;
}

.term-bright {
  color: #FFFFFF;
  font-weight: 500;
}

.term-kv-grid {
  padding-left: 0.85rem;
  display: grid;
  grid-template-columns: 92px 1fr;
  row-gap: 0.28rem;
  column-gap: 0.5rem;
  font-size: 0.72rem;
}

.term-kv-key {
  color: #76777B;
}

.term-kv-val--bright { color: #FFFFFF; }
.term-kv-val--normal { color: #D7DAE0; }
.term-kv-val--emerald { color: #4EDEA3; }

.term-out {
  margin: 0;
  padding-left: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: #D7DAE0;
}

.term-out--emerald { color: #4EDEA3; }
.term-out--error { color: #FF897D; }

.term-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: #14171D;
  border-top: 1px solid #1F242D;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.term-prompt-label {
  color: #4EDEA3;
  white-space: nowrap;
}

.term-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.term-input::placeholder {
  color: #646873;
}

/* Minimal Footer */
.status-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-variant);
}

/* ==========================================================================
   404 Page
   ========================================================================== */

.page-404 {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.card-404 {
  width: min(480px, 100%);
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  padding: 2rem;
}

/* ==========================================================================
   Mobile Layout (< 960px) — Compact Portrait Card + Bio + Large Bottom Dock
   ========================================================================== */

@media (max-width: 959px) {
  .topbar-inner {
    height: 52px;
    padding: 0 1.15rem;
  }

  .topbar-links,
  .desktop-actions,
  .status-footer {
    display: none;
  }

  .main-wrap {
    min-height: calc(100dvh - 53px);
    padding: 0.9rem 1.15rem 1.1rem;
    gap: 0.85rem;
  }

  .tectonic-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin: 0;
    flex: 1;
    align-content: space-between;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-sub {
    margin: 0.25rem 0 0.85rem;
    font-size: 0.74rem;
  }

  .specimen-card {
    grid-template-columns: 100px 1fr;
    gap: 0.85rem;
    padding: 0.75rem;
    margin-bottom: 0.8rem;
  }

  .specimen-photo-box {
    width: 100px;
    height: 100px;
  }

  .specimen-kv {
    gap: 0.32rem;
  }

  .specimen-kv-row {
    padding-bottom: 0.26rem;
    font-size: 0.66rem;
    gap: 0.5rem;
  }

  .specimen-kv-row > span:first-child {
    font-size: 0.58rem;
  }

  .bio {
    background: var(--surface-card);
    border: 1px solid var(--hairline);
    padding: 0.85rem;
    margin-bottom: 0;
    gap: 0.55rem;
    font-size: 0.84rem;
    line-height: 1.5;
  }

  /* Large Tactile Bottom Action Dock */
  .mobile-dock {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-top: 0.2rem;
  }

  .dock-shell-btn {
    width: 100%;
    min-height: 52px;
    padding: 0 1rem;
    border: 1px solid #1F242D;
    background: #0C0E12;
    color: #F1F1EF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    font-weight: 500;
  }

  .dock-shell-left {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
  }

  .dock-host {
    font-size: 0.7rem;
    color: #828691;
  }

  .dock-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .dock-btn {
    min-height: 48px;
    border: 1px solid var(--hairline);
    background: var(--surface-card);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
  }

  /* Mobile Terminal Sheet */
  .shell-panel {
    display: none;
  }

  body.shell-sheet-open .shell-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(12, 14, 18, 0.65);
    backdrop-filter: blur(4px);
  }

  body.shell-sheet-open .shell-panel {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: 85dvh;
    border-radius: 14px 14px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .term-hint {
    display: none;
  }

  .term-done {
    display: inline-flex;
  }
}
