:root {
  --color-bg: #ffffff;
  --color-text: #111111;
  --color-muted: #6b6a64;
  --color-sidebar: #5a6275;
  --color-accent: #3f5b43;
  --color-border: #dddddd;

  /* Grandview Display is used when installed (e.g. with Microsoft Office);
     Barlow Semi Condensed is a free, similar DIN-style web font for everyone else. */
  --font-heading: "Grandview Display", "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  --font-body: "Lora", Georgia, serif;

  --content-width: 42rem;
  --gutter: 1.25rem;
}

/* ---------- Language toggle: show only the active language ---------- */

html[lang="fil"] body [lang="en"],
html[lang="en"] body [lang="fil"] {
  display: none;
}

.lang-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-muted);
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  cursor: pointer;
}

html[lang="fil"] .lang-option[data-lang="fil"],
html[lang="en"] .lang-option[data-lang="en"] {
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- Base ---------- */

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh; /* excludes mobile browser toolbars where supported */
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration-color: var(--color-border);
  text-underline-offset: 0.2em;
  transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
  color: var(--color-accent);
  text-decoration-color: currentColor;
}

/* ---------- Home page ---------- */

.home-lang-toggle {
  position: absolute;
  top: 1.5rem;
  right: var(--gutter);
}

.home-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem var(--gutter) 2rem;
  text-align: center;
}

/* Three columns (bird | name | empty) with equal outer columns keep the name centered on the page. */
.home-identity {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(0.75rem, 3vw, 1.5rem);
  width: 100%;
}

.home-bird {
  justify-self: end;
  transform: translateY(-35%);
  width: clamp(3.5rem, 12vw, 7rem);
  height: auto;
}

.home-name {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 400;
}

.home-role {
  margin: 1rem 0 0;
  font-family: var(--font-heading);
  font-size: 1.6rem;
}

.home-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 4rem;
  margin-top: 4rem;
}

.home-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 10rem;
  height: 4.5rem;
  border: 1px solid var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.home-button:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ---------- Inner pages: layout (sidebar | content) ---------- */

body.with-sidebar {
  display: grid;
  /* Sidebar narrows on tablets and widens on desktops. */
  grid-template-columns: clamp(14rem, 28vw, 20rem) minmax(0, 1fr);
  align-items: start;
}

/* ---------- Inner pages: sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 5rem 1.5rem 2rem clamp(1.5rem, 4vw, 3.5rem);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

/* The Menu button only appears on phones (see the media query at the end). */
.menu-toggle {
  display: none;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text);
  cursor: pointer;
}

/* Burger icon: one middle line plus two lines drawn by ::before/::after; turns into an X when open. */
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 1.5rem;
  height: 2px;
  margin: 0 auto;
  background: currentColor;
  transition: transform 0.25s ease, background 0.25s ease;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-icon::before {
  transform: translateY(-7px);
}

.menu-icon::after {
  transform: translateY(7px);
}

.sidebar.is-open .menu-icon {
  background: transparent;
}

.sidebar.is-open .menu-icon::before {
  transform: rotate(45deg);
}

.sidebar.is-open .menu-icon::after {
  transform: rotate(-45deg);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.sidebar-name {
  color: var(--color-sidebar);
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-decoration: none;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 1.1rem;
}

.sidebar-nav a {
  color: var(--color-sidebar);
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a[aria-current="page"] {
  color: var(--color-text);
}

/* "Works" toggles its categories open and closed (native <details>, no JavaScript). */
.sidebar-label {
  color: var(--color-sidebar);
  cursor: pointer;
  list-style: none;
}

.sidebar-label::-webkit-details-marker {
  display: none;
}

.sidebar-label::after {
  content: "›";
  display: inline-block;
  margin-left: 0.5rem;
  transition: transform 0.2s;
}

.sidebar-group[open] .sidebar-label::after {
  transform: rotate(90deg);
}

.sidebar-label:hover {
  color: var(--color-text);
}

/* Slide + fade the categories open and closed. Browsers without support simply open instantly. */
.sidebar-group {
  interpolate-size: allow-keywords;
}

.sidebar-group::details-content {
  block-size: 0;
  opacity: 0;
  overflow: hidden;
  transition: block-size 0.3s ease, opacity 0.3s ease, content-visibility 0.3s allow-discrete;
}

.sidebar-group[open]::details-content {
  block-size: auto;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-group::details-content,
  .sidebar-label::after,
  .menu-icon,
  .menu-icon::before,
  .menu-icon::after {
    transition: none;
  }
}

.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-left: 1rem;
  font-size: 1rem;
}

.sidebar-copyright {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.75rem;
}

/* ---------- Inner pages: content ---------- */

.page {
  width: 100%;
  max-width: var(--content-width);
  padding: 5rem var(--gutter) 4rem;
}

.page h1 {
  margin: 0 0 2rem;
  font-size: 2.75rem;
}

.work {
  margin-bottom: 2.5rem;
}

.work-image {
  display: block;
  width: 100%;
  max-width: 18rem;
  height: auto;
  margin-bottom: 1rem;
  border-radius: 2px;
}

.work h2 {
  margin: 0;
  font-size: 1.6rem;
}

.work-meta {
  margin: 0.25rem 0 0.75rem;
  color: var(--color-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ---------- Contact form ---------- */

.contact-form {
  display: grid;
  gap: 1.25rem;
}

.contact-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 2px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 1rem; /* 16px+ stops iOS from zooming in on focus */
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.contact-form button {
  justify-self: start;
  padding: 0.7rem 1.75rem;
  border: 1px solid var(--color-text);
  border-radius: 2px;
  background: var(--color-text);
  color: var(--color-bg);
  font: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.contact-form button:hover {
  background: transparent;
  color: var(--color-text);
}

.contact-form button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.form-status {
  margin: 0;
  color: var(--color-muted);
}

.form-status[data-status="error"] {
  color: #9b2c2c;
}

.honeypot {
  position: absolute;
  left: -9999px;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 2rem var(--gutter);
  color: var(--color-muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer p {
  margin: 0.25rem 0;
}

.credit {
  font-size: 0.8rem;
}

/* ---------- Phones ---------- */

@media (max-width: 40rem) {
  /* Home: bird sits above the name instead of beside it. */
  .home-identity {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .home-bird {
    justify-self: center;
    width: 5rem;
    transform: none;
  }

  .home-nav {
    margin-top: 3rem;
  }

  /* Inner pages: compact top bar with a Menu button instead of the full sidebar. */
  body.with-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    padding: 1.25rem var(--gutter);
  }

  .sidebar-name {
    font-size: 1.4rem;
  }

  .menu-toggle {
    display: block;
  }

  /* Collapsed menu: slides open and fades in. visibility keeps hidden links out of keyboard focus.
     Browsers without interpolate-size open instantly but still fade. */
  .sidebar-menu {
    gap: 1.5rem;
    height: 0;
    margin-top: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    interpolate-size: allow-keywords;
    transition: height 0.3s ease, margin-top 0.3s ease, opacity 0.3s ease, visibility 0.3s;
  }

  .sidebar.is-open .sidebar-menu {
    height: auto;
    margin-top: 1.5rem;
    opacity: 1;
    visibility: visible;
  }

  .page {
    padding-top: 2rem;
  }

  .page h1 {
    font-size: 2.25rem;
  }
}

/* Placed last so it overrides the phone menu transition above. */
@media (prefers-reduced-motion: reduce) {
  .sidebar-menu {
    transition: none;
  }
}
