@font-face {
  font-family: 'IBM Plex Sans';
  src: url('resources/font/IBM_Plex_Sans/IBMPlexSans-VariableFont.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
}

body {
  overflow: visible;
  /* keep the radial gradient visually fixed while scrolling */
  background: radial-gradient(circle at top left, #444 0%, #000 50%);
  background-attachment: fixed;
  /* allow narrow portrait phones — don't force wide min-width */
  min-width: 320px;
  background-color: black;
  color: #FFF;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* Robust fixed background fallback: draw the gradient once in a fixed pseudo-element
   This prevents the gradient from appearing to move on some browsers or setups */
html::before {
  content: "";
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0; */
  z-index: -1; /* behind all content */
  background: radial-gradient(circle at top left, #444 0%, #000 50%);
  pointer-events: none;
}

#resume-container {
  width: 80%;
  /* allow normal page height and keep space for fixed header */
  height: auto;
  align-content: center;
  justify-content: center;
  margin: 1rem auto;
  padding: calc(3rem + 10rem) 3rem 3rem; /* top padding = existing padding + header height */
}

section {
  margin-bottom: 15rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.container {
  max-width: 80vw;
}

a {
  color: #FFF;
  text-decoration: none;
  border: none;
}

h1 {
  margin-bottom: 3rem;
  font-size: 3rem;
}

#header {
  height: 10rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent; /* optional: add background if you want it opaque */
}

/* inner header centered to match page content, right-align children */
#header > header {
  width: 80%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 1rem 3rem; /* top/bottom + match page horizontal inset */
  height: 100%;
  display: flex;
  flex-direction: column;    /* stack name above nav */
  justify-content: center;   /* center vertically within header height */
  align-items: flex-end;     /* right-align the stacked items */
  gap: 0.5rem;
}

/* remove float fallback */
header {
  float: none;
}


/* small adjustments so elements align cleanly */
#header h1 { 
  margin: 100px 0px 0px 0px;
  font-size: 2rem;
}
#header > header > div { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
#navbar { list-style-type: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; }
#navbar li { margin: 0; }

#navbar {
  list-style-type: none;
  padding: 0;
  margin: 0;
  margin-top: 0.5rem; /* space under the name */
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: flex-end;
}

#navbar li {
  margin: 0;
  font-size: 1rem;
}

.active {
  text-decoration: underline;
  text-underline-offset: .4rem;
}

#education>div:nth-child(2)>ul>li {
  width: 15rem;
}

#resume-container>section {
  float: left;
}


#skills .container>div {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  /* allows stacking on narrow screens */
  align-items: flex-start;
}

/* equal widths, but won't shrink below min-width (prevents text wrapping) */
#skills .container>div ul {
  flex: 1 1 0;
  /* share available space equally */
  min-width: 220px;
  /* adjust so list items don't wrap */
  box-sizing: border-box;
  margin: 0;
  padding-left: 1rem;
  list-style: disc inside;
}

/* on small screens, stack lists vertically */
@media (max-width: 700px) {
  #skills .container>div ul {
    flex: 1 1 100%;
    min-width: auto;
  }
}


#summary-p {
  max-width: 65%;
}

pre {
  /* use viewport height so tall portrait screens allocate more space */
  max-height: 70vh;
  overflow-y: auto;
  padding: 1em;
  background: #f5f5f5;
  border: 1px solid #ccc;
  white-space: pre-wrap;
  word-break: break-word;
  width: 70vw;
  max-width: 100%;
  box-sizing: border-box;
}

@media (orientation: portrait) {
  pre {
    max-height: 80vh;
  }
  pre[class*="language-"] {
    max-height: 80vh;
    font-size: 1em;
    padding: 1.2em;
  }
}

@media (max-width: 600px) {
  pre[class*="language-"] {
    /* fallback for small narrow screens */
    max-height: 70vh;
    font-size: 1em;
    padding: 1.2em;
  }
}

/* Contact form — modern, stacked, sleek */
#contact .container {
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  /* keep horizontal breathing room on narrow screens */
}

#contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  width: 100%;
  max-width: 100%;
  padding: 1.5rem;
  /* slightly more interior padding for the wider layout */
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.55);
  box-sizing: border-box;

  /* height based on viewport */
  height: 55vh; /* primary target */
  min-height: 50vh;         /* don't collapse on small viewports */
  max-height: 85vh;         /* keep some room for header/footer */
  overflow-y: auto;         /* allow internal scrolling if content exceeds height */
}

/* labels */
#contact-form label {
  font-size: 0.78rem;
  color: #dfeffd;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .25rem;
}

/* inputs */
#contact-form input[type="text"],
#contact-form input[type="email"],
#contact-form textarea {
  width: 100%;
  padding: .75rem .9rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
  color: #fff;
  font-size: 0.98rem;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease;
  resize: vertical;
}

/* prevent overlap and preserve spacing */
#contact-form textarea { min-height: 9rem; line-height: 1.4; }
#contact-form textarea {
  flex: 1 1 auto;    /* grow/shrink to fill leftover space */
  min-height: 0;     /* allow flexbox to shrink it when needed */
  height: auto;      /* prefer flex sizing over fixed height */
  overflow: auto;
}

/* focus / validation */
#contact-form input:focus,
#contact-form textarea:focus {
  border-color: #66a3ff;
  box-shadow: 0 6px 18px rgba(102,163,255,0.09);
  outline: none;
}

#contact-form input:invalid,
#contact-form textarea:invalid {
  border-color: #ff6b6b;
}

/* submit button */
#contact-form button[type="submit"] {
  align-self: flex-end;
  padding: .6rem 1rem;
  background: linear-gradient(90deg,#3b82f6 0%, #06b6d4 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px rgba(6,118,189,0.25);
  transition: transform .08s ease, box-shadow .12s ease, opacity .12s ease;
}

/* Apply the same visual style to all buttons/site button-like elements */
button,
input[type="button"],
input[type="submit"],
.button,
.btn {
  padding: .6rem 1rem;
  background: linear-gradient(90deg,#3b82f6 0%, #06b6d4 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px rgba(6,118,189,0.25);
  transition: transform .08s ease, box-shadow .12s ease, opacity .12s ease, background .12s ease;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  line-height: 1;
  text-decoration: none;
}

/* hover / active states match the contact submit behaviour */
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
.button:hover,
.btn:hover {
  transform: translateY(-2px);
}
button:active,
input[type="button"]:active,
input[type="submit"]:active {
  transform: translateY(0);
  opacity: .95;
}

/* focus ring for accessibility */
button:focus,
input[type="button"]:focus,
input[type="submit"]:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.12), 0 8px 20px rgba(6,118,189,0.18);
}

/* subtle hover / active */
#contact-form button[type="submit"]:hover { transform: translateY(-2px); }
#contact-form button[type="submit"]:active { transform: translateY(0); opacity: .95; }

/* status / feedback */
#contact-status {
  min-height: 1.25rem;
  font-size: .95rem;
  color: #d7f3ff;
  margin-top: .25rem;
}

/* small helper: mark required fields visually */
#contact-form input[required]::placeholder,
#contact-form textarea[required]::placeholder { opacity: .5; }

/* keep same behavior on small screens */
@media (max-width: 520px) {
  #contact-form textarea {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* subtle font-size (keep near-default) */
  html, body {
    font-size: 16px; /* previously 18px, now reduced */
  }

  /* header: larger name & easier-to-tap nav items */
  #header h1 { font-size: 1.6rem; }
  .nav-tab, #navbar li {
    font-size: 1.05rem;
  }
  .nav-tab {
    display: inline-block;
    padding: 0.5rem 0.6rem;
    min-height: 44px; /* recommended tappable size */
    box-sizing: border-box;
  }

  /* form fields: bigger text and more padding */
  #contact-form input[type="text"],
  #contact-form input[type="email"],
  #contact-form textarea {
    font-size: 1rem;
    padding: 0.9rem 1rem;
  }

  /* textarea should expand (fills remaining space) and remain scrollable */
  #contact-form textarea {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: auto;
  }

  /* submit button: larger, comfortable touch target */
  #contact-form button[type="submit"],
  button {
    font-size: 1.05rem;
    padding: 0.9rem 1.1rem;
    min-height: 48px;
    border-radius: 12px;
  }

  /* keep form filling viewport under fixed header */
  #contact-form {
    height: calc(100vh - 12rem);
    padding: 1.1rem;
    overflow-y: auto;
  }
}

/* Mobile styles applied when .is-mobile is present on <html> */
html.is-mobile, html.is-mobile body {
  font-size: 16px; /* keep text size restrained */
}

/* MOBILE: header background only on mobile */
html.is-mobile #header {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  height: 3rem; /* slightly shorter on mobile */
}

/* ensure main content padding matches the shorter header on mobile */
html.is-mobile #resume-container {
  /* reduced top padding so there's less wasted space above content */
  padding: calc(0.5rem + 3rem) 1rem 1rem;
}

/* Hamburger button (hidden on desktop) */
#nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: .5rem;
  margin-right: .25rem;
  cursor: pointer;
  color: inherit;

  /* ensure toggle sits above the off-canvas nav and header */
  z-index: 1200; /* navbar is 1100, header 1000 */
  /* layout utilities kept, actual display enabled only on mobile via .is-mobile */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* simple 3-bar icon */
#nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 0; /* use flex gap for spacing */
  border-radius: 1px;
  transition: transform .22s ease, opacity .18s ease;
  transform-origin: center;
}

/* show toggle on mobile via is-mobile class */
html.is-mobile #nav-toggle {
  /* already inline-flex above; keep visibility gated by is-mobile */
  display: inline-flex;

  /* ensure the hamburger sits in the left corner on mobile */
  position: fixed;
  left: 0.5rem;
  top: 0rem;
  z-index: 1300; /* keep above header/nav */
}

/* Off-canvas nav for mobile */
html.is-mobile #navbar {
  position: fixed;
  top: 3rem;            /* align with new header height */
  left: 0;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.2,.9,.2,1);
  width: 78%;
  max-width: 340px;
  padding: 1rem;
  background: rgba(8,8,12,0.95);
  box-shadow: 2px 0 20px rgba(0,0,0,0.5);
  height: calc(100vh - 3rem); /* account for new header height */
  overflow-y: auto;
  flex-direction: column;
  align-items: flex-start;
  z-index: 1100;
}

/* When nav is open (we toggle .nav-open on <html>) */
html.is-mobile.nav-open #navbar {
  transform: translateX(0);
}

/* transform hamburger into an X when open */
html.is-mobile.nav-open #nav-toggle .bar:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}
html.is-mobile.nav-open #nav-toggle .bar:nth-child(2) {
  opacity: 0;
}
html.is-mobile.nav-open #nav-toggle .bar:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* Keep nav items readable when off-canvas */
html.is-mobile #navbar .nav-tab {
  display: block;
  padding: 0.6rem 0;
  width: 100%;
}

/* Ensure header layout adjusts on mobile so the toggle sits left */
html.is-mobile #header > header {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: .8rem 1rem;
}

/* keep name still visible and not oversized */
html.is-mobile #header h1 {
  font-size: 1.1rem;
  margin: 0;

  /* center the name horizontally in the viewport on mobile */
  position: fixed;
  left: 50%;
  top: 0.75rem; /* half of the mobile header height (header = 3rem) */
  transform: translateX(-50%);
  z-index: 1200; /* keep below the hamburger (1300) so the toggle remains tappable */
  white-space: nowrap;
}

/* Mobile (via .is-mobile): contact card grows to fit and message area is taller */
html.is-mobile #contact-form {
  height: auto;
  max-height: none;
  overflow-y: visible;
  padding: 1.1rem;
  box-sizing: border-box;
}

/* on mobile, expand contact card into side gutters by 50% of the extra space */
html.is-mobile #contact-form {
  width: calc(100% + 10vw); /* increase width by 10vw (fills ~50% of the usual side gutters) */
  margin-left: -5vw;        /* shift half of that to keep it centered */
  margin-right: -5vw;
  max-width: none;
  box-sizing: border-box;
}

html.is-mobile #contact-form textarea {
  flex: none;
  min-height: 12rem;
  height: auto;
  overflow: visible;
}

/* Ensure the management page heading sits below the mobile header when html.is-mobile is present */
html.is-mobile h2#site-management-heading {
  margin-top: 3.5rem; /* header is 3rem high on mobile; add a bit of breathing room */
}

/* MOBILE: reduce code block font-size when html.is-mobile is present */
html.is-mobile pre,
html.is-mobile pre[class*="language-"] {
  font-size: 0.5rem;      /* smaller on mobile; tweak (e.g. 0.85rem) as desired */
  line-height: 1;      /* keep readability */
  word-break: break-word; /* avoid overflow on narrow screens */
}

/* Management container mirrors contact form styles so the manage page looks consistent */
#management-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  width: 100%;
  max-width: 100%;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.55);
  box-sizing: border-box;
  height: 55vh;
  min-height: 50vh;
  max-height: 85vh;
  overflow-y: auto;
}

#management-container label {
  font-size: 0.78rem;
  color: #dfeffd;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .25rem;
}

#management-container input[type="text"],
#management-container input[type="email"],
#management-container textarea {
  width: 100%;
  padding: .75rem .9rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
  color: #fff;
  font-size: 0.98rem;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease;
  resize: vertical;
}

#management-container textarea { min-height: 9rem; line-height: 1.4; }
#management-container textarea {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
}

#management-container input:focus,
#management-container textarea:focus {
  border-color: #66a3ff;
  box-shadow: 0 6px 18px rgba(102,163,255,0.09);
  outline: none;
}

#management-container input:invalid,
#management-container textarea:invalid {
  border-color: #ff6b6b;
}

#management-container button[type="submit"] {
  align-self: flex-end;
  padding: .6rem 1rem;
  background: linear-gradient(90deg,#3b82f6 0%, #06b6d4 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px rgba(6,118,189,0.25);
  transition: transform .08s ease, box-shadow .12s ease, opacity .12s ease;
}

#management-container button[type="submit"]:hover { transform: translateY(-2px); }
#management-container button[type="submit"]:active { transform: translateY(0); opacity: .95; }

#management-container input[required]::placeholder,
#management-container textarea[required]::placeholder { opacity: .5; }

@media (max-width: 520px) {
  #management-container textarea {
    flex: 1 1 auto;
    min-height: 0;
  }

  html.is-mobile #management-container {
    height: auto;
    max-height: none;
    overflow-y: visible;
    padding: 1.1rem;
    box-sizing: border-box;
    width: calc(100% + 10vw);
    margin-left: -5vw;
    margin-right: -5vw;
    max-width: none;
  }

  html.is-mobile #management-container textarea {
    flex: none;
    min-height: 12rem;
    height: auto;
    overflow: visible;
  }
}

.file-tree {
  background-color: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.3;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
  max-width: fit-content;
}

.file-tree ul {
  list-style: none;
  padding-left: 1.25em;
  margin: 0;
}

.file-tree li {
  position: relative;
  margin: 0.1em 0;
  padding-left: 1.2em;
  /* controls text indent */
}

.file-tree li::before {
  content: "├─";
  position: absolute;
  left: 0;
  width: 1em;
  text-align: left;
  color: #555;
}

.file-tree .folder {
  color: #569cd6;
  font-weight: bold;
}

.file-tree .file {
  color: #dcdcaa;
}