/* ---------- Tokens ---------- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f2f2f2;
  --color-topbar: #1a1a1a;
  --color-text: #252525;
  --color-muted: #8a8a8a;
  --color-accent: #0fa89d;
  --color-btn: #1fcb32;
  --color-border: #e2e2e2;
  --radius: 10px;
  --font-body: 'Roboto', Arial, sans-serif;
  --font-display: 'Alex Brush', cursive;
  --max-width: 1100px;
}

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: 'Alex Brush';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/AlexBrush-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/Roboto-300.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Roboto-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Roboto-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Roboto-700.woff2') format('woff2');
}

[data-theme="dark"] {
  --color-bg: #14161a;
  --color-bg-alt: #1c1f24;
  --color-topbar: #0d0e10;
  --color-text: #e8e8e6;
  --color-muted: #a0a0a0;
  --color-border: #33363b;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  font-size: 16px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-muted);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  color: var(--color-accent);
}

h1,
h2 {
  margin: 0;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--color-topbar);
  color: #fff;
  font-size: 0.8rem;
}

.topbar__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem 1rem;
}

.topbar__contact {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.topbar__contact a {
  color: #ddd;
}

.topbar__contact a:hover,
.topbar__contact a:focus-visible {
  color: var(--color-accent);
}

/* ---------- Nav ---------- */
.nav {
  background: #fff;
  box-shadow: 0 3px 8px 1px #777777;
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo img {
  width: 44px;
  height: auto;
}

.nav__right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--color-text);
}

.theme-toggle__icon--moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: block;
}

[data-theme="dark"] .nav {
  box-shadow: 0 3px 5px 0px #000000;
}

[data-theme="dark"] .nav,
[data-theme="dark"] .nav__menu {
  background: var(--color-bg-alt);
}

[data-theme="dark"] .diplomas__grid li {
  background: var(--color-bg-alt);
}

[data-theme="dark"] .contact__form input,
[data-theme="dark"] .contact__form textarea {
  background: var(--color-bg-alt);
}

.nav__toggle {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav__toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  display: block;
}

.nav__menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  flex-direction: column;
  display: none;
}

.nav__menu.is-open {
  display: flex;
}

.nav__menu.is-open li {
  text-align: center;
}

.nav__menu li a {
  display: block;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
}

.nav__menu li+li {
  border-top: 1px solid var(--color-border);
}

.nav__menu li a.is-active {
  color: var(--color-accent);
  font-weight: 700;
}

@media (min-width: 700px) {
  .nav__toggle {
    display: none;
  }

  .nav__menu {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    border: 0;
    background: none;
  }

  .nav__menu li+li {
    border: 0;
  }

  .nav__menu li a {
    padding: 0.5rem 0.75rem;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 3rem 1.25rem 2.5rem;
  background: var(--color-bg-alt);
  overflow: hidden;
  scroll-margin-top: 100px;
}

.hero__portraits {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.hero__portrait {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.hero__name {
  font-family: emoji;
  font-size: 3rem;
  font-weight: 400;
  color: #fbfbfa;
  text-shadow: 2px 2px 5px black;
  letter-spacing: 0.5px;
}

.hero__role {
  color: var(--color-text);
  font-weight: 500;
  margin: 0.75rem 0 1.5rem;
  font-size: 1.05rem;
}

.hero__bio {
  max-width: 640px;
  margin: 0 auto;
  color: var(--color-muted);
}

.hero__bio p {
  margin: 0 0 1rem;
}

/* ---------- Services ---------- */
.services {
  display: grid;
  gap: 2rem;
  max-width: var(--max-width);
  margin: 2.5rem auto 0;
  padding: 0 1.25rem;
  text-align: center;
}

.services__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.services__item p {
  color: var(--color-muted);
  font-size: 0.92rem;
  margin: 0;
}

@media (min-width: 700px) {
  .services {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .services {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ---------- Section titles ---------- */
.section-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 400;
  padding: 2.5rem 1rem 1.5rem;
}

/* ---------- Diplomas ---------- */
.diplomas {
  background: var(--color-bg);
  padding-bottom: 5rem;
  scroll-margin-top: 100px;
}

.diplomas__grid {
  display: grid;
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.diplomas__grid li {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.diplomas__grid li img {
  transition: transform 0.5s ease;
}

.diplomas__grid li:hover img {
  transform: scale(1.08);
}

@media (min-width: 700px) {
  .diplomas__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Portfolio ---------- */
.portfolio {
  padding-bottom: 5rem;
  background: var(--color-bg-alt);
  scroll-margin-top: 100px;
}

.portfolio__list {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  gap: 1.5rem;
}

.portfolio__item {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 3px 2px #8a8a8a;
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.portfolio__item:hover {
  transform: translateY(8px);
  box-shadow: 0 0 2px 1px #8a8a8a;
}

.portfolio img {
  max-width: 100%;
  min-width: -webkit-fill-available;
  /*min-width: stretch;*/
  height: auto;
  display: block;
}

.portfolio__url {
  text-align: center;
  margin: 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  word-break: break-all;
}

/* ---------- Contact ---------- */
.contact {
  background: var(--color-bg);
  scroll-margin-top: 100px;
}

.contact__form {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact__form label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 0.75rem;
}

.contact__row {
  display: flex;
  flex-direction: column;
}

.contact__field {
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  .contact__row {
    flex-direction: row;
    gap: 1rem;
  }

  .contact__field {
    flex: 1;
  }
}

.contact__form input,
.contact__form textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  color: var(--color-text);
}

.contact__form input:focus,
.contact__form textarea:focus {
  border-color: var(--color-accent);
}

.contact__form button {
  margin-top: 1.5rem;
  align-self: center;
  background: #158d22;
  color: #fff;
  border: 1px solid white;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

.contact__form button:hover,
.contact__form button:focus-visible {
  opacity: 0.9;
}

.contact__status {
  font-size: 0.9rem;
  color: var(--color-accent);
  min-height: 1.2em;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 2.5rem 1.25rem;
  background: var(--color-topbar);
}

.footer img {
  width: 48px;
  margin: 0 auto 1rem;
}

.footer p {
  margin: 0 0 1rem;
  color: #bbb;
  font-size: 0.85rem;
}

.footer__contact {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.footer__contact a {
  color: #ddd;
}

.footer__contact a:hover,
.footer__contact a:focus-visible {
  color: var(--color-accent);
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--color-accent);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}