/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  max-width: min(390px, 58vw);
}

.brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
}

.brand__text {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}

.brand__text span {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__text small {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Navigation controls */
.nav__link {
  position: relative;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 650;
  transition: color 180ms ease, background 180ms ease;
}

.nav__link:hover,
.nav__link.is-active {
  background: var(--color-primary-dim);
  color: var(--color-text);
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 800;
  transition: border-color 180ms ease, background 180ms ease;
}

.language-toggle:hover {
  border-color: rgb(0 212 170 / 0.42);
  background: var(--color-primary-dim);
}

.language-toggle svg {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

.error-language-toggle {
  justify-self: start;
}

.nav__toggle {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.nav__toggle:hover,
.nav__toggle[aria-expanded="true"] {
  border-color: rgb(0 212 170 / 0.42);
  background: var(--color-primary-dim);
}

.nav__toggle-mark {
  position: relative;
  width: 17px;
  height: 12px;
}

.nav__toggle-mark::before,
.nav__toggle-mark::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: top 180ms ease, bottom 180ms ease, transform 180ms ease;
}

.nav__toggle-mark::before {
  top: 2px;
}

.nav__toggle-mark::after {
  bottom: 2px;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-mark::before {
  top: 5px;
  transform: rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-mark::after {
  bottom: 5px;
  transform: rotate(-45deg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 1.05rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 750;
  max-width: 100%;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #031411;
}

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
}

.btn--secondary:hover {
  border-color: rgb(0 212 170 / 0.42);
}

/* Shared card surfaces */
.terminal-card,
.profile-panel,
.skill-group,
.project-card,
.more-card,
.contact-panel,
.error-card {
  max-width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.035), transparent), var(--color-surface);
  box-shadow: var(--shadow-soft);
}

/* Terminal card */
.terminal-card {
  overflow: hidden;
  justify-self: end;
  width: 100%;
  min-width: 0;
}

.terminal-card__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.terminal-card__bar span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--color-text-faint);
}

.terminal-card__bar span:first-child {
  background: var(--color-primary);
}

.terminal-card__bar p {
  margin-left: 0.5rem;
  color: var(--color-text-muted);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-card__body {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
  padding: clamp(1rem, 4vw, 1.6rem);
}

.terminal-card__body p,
.terminal-card__body pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.72rem, 0.65rem + 0.22vw, 0.88rem);
  line-height: 1.6;
}

.terminal-card__body p {
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.terminal-card__body p span {
  color: var(--color-primary);
}

.terminal-card__body pre {
  overflow-x: auto;
  max-width: 100%;
  margin: 0;
  color: var(--color-text-muted);
}

.terminal-card__status {
  padding-top: 0.4rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-primary) !important;
}

/* Profile and stats */
.profile-panel {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 1.4rem;
  padding: clamp(1rem, 4vw, 1.4rem);
  background:
    radial-gradient(circle at 50% 18%, rgb(0 212 170 / 0.18), transparent 34%),
    linear-gradient(145deg, rgb(0 212 170 / 0.08), transparent 48%),
    var(--color-surface);
}

.profile-panel h2 {
  max-width: 17ch;
  font-size: clamp(1.35rem, 1.05rem + 0.9vw, 1.85rem);
  line-height: 1.08;
}

.profile-panel__avatar {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-height: 360px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.profile-panel__avatar img {
  width: min(78%, 280px);
  aspect-ratio: 1;
  border-radius: 999px;
  object-fit: cover;
  filter: drop-shadow(0 18px 42px rgb(0 212 170 / 0.18));
}

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

.stat-card {
  min-height: 92px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  text-align: center;
}

.stat-card strong {
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 0.95rem + 0.45vw, 1.32rem);
  line-height: 1;
}

.stat-card span {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1.35;
}

/* Timelines */
.timeline {
  display: grid;
  gap: 1rem;
}

.timeline--education {
  margin-top: 1rem;
}

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1rem;
  padding-left: 1rem;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 1px;
  height: calc(100% + 1rem);
  background: var(--color-border);
}

.timeline__item::after {
  content: "";
  position: absolute;
  left: -3px;
  top: 0.45rem;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--color-primary);
}

.timeline__item span {
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 800;
}

.timeline__item p {
  color: var(--color-text);
  min-width: 0;
}

.timeline__item--work {
  grid-template-columns: 90px 1fr;
  padding: 1.4rem 0 1.4rem 1.3rem;
}

.timeline__role {
  margin: 0.35rem 0 1rem;
  color: var(--color-primary) !important;
  font-weight: 700;
}

.achievement-list {
  color: var(--color-text-muted);
  min-width: 0;
}

/* Skills */
.skill-group {
  padding: 1.2rem;
  background-color: var(--color-surface);
}

.skill-group h3 {
  margin-bottom: 1rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-list span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 650;
  max-width: 100%;
}

/* Projects */
.project-card {
  display: grid;
  align-content: space-between;
  gap: 1.3rem;
  min-height: 220px;
  padding: clamp(1.2rem, 4vw, 1.6rem);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.project-card:hover,
.skill-group:hover,
.more-card:hover,
.contact-panel:hover {
  border-color: rgb(0 212 170 / 0.36);
  box-shadow: 0 20px 70px rgb(0 212 170 / 0.08);
  transform: translateY(-2px);
}

.project-card h3 {
  margin: 0.5rem 0 0.75rem;
}

.project-card__media {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
}

.project-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease, filter 260ms ease;
}

.project-card:hover .project-card__media img {
  filter: saturate(1.08);
  transform: scale(1.025);
}

.project-card--featured {
  background:
    linear-gradient(135deg, rgb(0 212 170 / 0.12), transparent 45%),
    var(--color-surface);
}

.project-card--featured h3 {
  font-size: var(--text-xl);
}

.project-card--accent {
  background: var(--color-surface-2);
}

.project-card__type {
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
}

/* Personal notes */
.more-card {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 2rem;
  align-items: start;
  padding: clamp(1.2rem, 4vw, 1.6rem);
  background:
    linear-gradient(120deg, rgb(0 212 170 / 0.08), transparent 40%),
    var(--color-surface);
}

.more-card h2 {
  font-size: var(--text-xl);
}

.more-card.is-sparked {
  border-color: rgb(0 212 170 / 0.34);
}

/* Contact */
.contact-panel {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 1.4rem);
}

.contact-row,
.link-group {
  display: grid;
  gap: 0.65rem;
}

.link-group h3 {
  margin-top: 0.4rem;
  font-size: var(--text-sm);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.contact-panel a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-weight: 700;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
  min-width: 0;
}

.contact-panel a span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.contact-panel a:hover {
  border-color: rgb(0 212 170 / 0.45);
  background: var(--color-primary-dim);
  transform: translateX(2px);
}

.contact-panel svg {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  flex: 0 0 auto;
}

.link-group--primary {
  grid-template-columns: 1fr 1fr;
}

.link-group--primary h3 {
  grid-column: 1 / -1;
}

.link-group--primary a {
  min-height: 58px;
  border-color: rgb(0 212 170 / 0.32);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
}

.site-footer p {
  font-size: var(--text-sm);
  min-width: 0;
}

.back-to-top {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

/* Error page */
.error-card {
  display: grid;
  gap: 1rem;
  padding: clamp(1.5rem, 6vw, 2.4rem);
}

.error-card h1 {
  max-width: 9ch;
}

/* Component responsive states */
@media (max-width: 900px) {
  .nav__toggle {
    display: inline-grid;
  }

  .nav__link {
    padding: 0.8rem 0.9rem;
  }

  .profile-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .stats-grid,
  .more-card,
  .link-group--primary {
    grid-template-columns: 1fr;
  }

  .timeline__item,
  .timeline__item--work {
    grid-template-columns: 58px 1fr;
    gap: 0.75rem;
  }

  .brand__logo {
    width: 38px;
    height: 38px;
  }

  .nav__toggle {
    width: 36px;
    height: 36px;
  }

  .nav__toggle-mark {
    width: 15px;
  }

  .profile-panel {
    justify-items: center;
    text-align: center;
  }

  .profile-panel .stats-grid {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .brand {
    max-width: calc(100vw - 92px);
  }

  .hero__role {
    min-height: 4.2rem;
  }

  .terminal-card__body {
    gap: 0.75rem;
  }

  .stat-card {
    min-height: 86px;
    padding: 0.7rem 0.55rem;
  }

  .stat-card strong {
    font-size: var(--text-base);
  }

  .timeline__item,
  .timeline__item--work {
    grid-template-columns: 1fr;
    padding-left: 1rem;
  }

  .timeline__item span {
    line-height: 1;
  }
}

@media (max-width: 390px) {
  .contact-panel {
    padding: 0.85rem;
  }
}
