html.dark-mode-early { background-color: #1e1e20; color-scheme: dark; }
html.dark-mode-early body { background-color: #2B2B2D; color: #f1f1f1; }

html.no-transitions,
html.no-transitions *,
html.no-transitions *::before,
html.no-transitions *::after { transition: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  color: #2B2B2D;
  background-color: #fcfcfc;
}

h2 { font-size: 3rem; font-weight: 700; margin-bottom: 2rem; }

#custom-header {
  background-color: rgba(252, 252, 252, 0.01);
  backdrop-filter: blur(60px);
  -webkit-backdrop-filter: blur(60px);
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 72px;
  border-bottom: 1px solid rgba(220, 220, 220, 0.5);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background-color 0.3s, border-color 0.3s;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1030px;
  margin: 0 auto;
}

.header-left { display: flex; align-items: center; min-width: 80px; }
.header-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 0.5rem; min-width: 80px; justify-content: flex-end; }
.logo-placeholder { width: 80px; height: 1px; }

.header-back-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--port-text-2, #666);
  text-decoration: none;
  transition: color 0.25s;
  white-space: nowrap;
}
.header-back-link:hover { color: var(--port-accent, #007bff); }
.header-back-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-menu {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-menu a {
  text-decoration: none;
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.25s;
  position: relative;
}
.nav-menu a:hover { color: #007bff; }
.nav-menu a.active { color: #007bff; font-weight: 500; }

.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid #e8e8e8;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s, transform 0.3s;
  color: #2B2B2D;
  padding: 0;
  outline: none;
}
.theme-toggle:hover { border-color: #007bff; transform: rotate(20deg); }
.theme-toggle svg { width: 15px; height: 15px; }

.theme-svg { display: block; width: 15px; height: 15px; color: inherit; transition: color 0.2s ease; }

.burger { display: none; background: none; border: none; cursor: pointer; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }
.burger:focus, .burger:active { outline: none; }
.mobile-menu { display: none; flex-direction: column; align-items: flex-start; padding: 1rem; transition: all 0.3s ease; }
.hidden { display: none !important; }

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  min-height: 80vh;
  max-height: 1200px;
  position: relative;
  padding-top: 90px;
  box-sizing: border-box;
}

.avatar { width: 320px; height: 320px; border-radius: 50%; object-fit: cover; margin-top: 16px; box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.hero h1 { font-size: 3.5rem; font-weight: 700; margin-bottom: 0; color: inherit; }
.animated-roles { font-size: 1.5rem; font-weight: 400; color: #666; height: 2rem; position: relative; }
#changing-text { display: inline-block; transition: opacity 0.5s ease-in-out; }

.full-width-section { background-color: #f5f5f5; padding: 3rem 0; }

.grid-wrapper { padding: 3rem 1.5rem; max-width: 1000px; margin: 0 auto; }
section.grid-wrapper, #about, #contact { padding: 3rem 2rem; margin: 0 auto; text-align: center; }
#about p { text-align: left; }
#contact p, .contact-desc { font-size: 1.6rem; }

#case-studies { padding: 4rem 2rem 8rem; max-width: 1000px; margin: auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  outline: 16px solid #e8e8e8;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin: 16px;
  text-align: left;
}
.card img { width: 100%; height: auto; display: block; object-fit: cover; }
.card-content { padding: .8rem; }
.card h3 { margin: 0; font-size: 1.2rem; font-weight: bold; }
.card p { margin-top: 8px; margin-bottom: 8px; color: #777; font-size: 0.8rem; }
.card:hover { transform: translateY(-5px); outline: 16px solid #dcedff; }
.card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,123,255,0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}
.card:hover::after { opacity: 1; }

.tag {
  background-color: #f1f1f1;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  font-size: 0.75rem;
  margin-right: 0.4rem;
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
  display: inline-block;
  transition: background-color 0.3s ease;
}

.button-filled {
  color: #fff;
  background-color: #333;
  padding: 0.8rem 20px 0.8rem 0;
  border: 4px solid #333;
  border-radius: 40px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  width: fit-content;
  min-width: 180px;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.button-filled:hover { background-color: #007bff; color: #fff; border-color: #007bff; }
.button-filled:hover .icon-wrapper { transform: translateX(0); opacity: 1; }
.button-filled:hover .icon-wrapper img { filter: brightness(0) saturate(100%) invert(1); }
.button-filled:hover .icon-wrapper svg { color: #fff; stroke: #fff; }
.button-filled:hover .button-text { transform: translateX(10px); }

.button-muted {
  color: #333;
  background-color: transparent;
  border: 4px solid #e8e8e8;
  padding: 0.8rem 20px 0.8rem 0;
  border-radius: 40px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  width: fit-content;
  min-width: 180px;
  position: relative;
  overflow: hidden;
}
.button-muted:hover { background-color: #007bff; color: #fff; border-color: #007bff; }
.button-muted:hover .icon-wrapper { transform: translateX(0); opacity: 1; }
.button-muted:hover .icon-wrapper img { filter: brightness(0) saturate(100%) invert(1); }
.button-muted:hover .icon-wrapper svg { color: #fff; stroke: #fff; }
.button-muted:hover .button-text { transform: translateX(10px); }

.icon-wrapper {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.3s ease;
}
.icon-hover { width: 100%; height: 100%; display: block; }
.icon-wrapper img { filter: brightness(0) saturate(100%) invert(0); transition: filter 0.3s ease; display: block; }
.icon-wrapper svg { color: #333; transition: color 0.3s ease, stroke 0.3s ease; }
.button-text { transition: transform 0.3s ease; white-space: nowrap; }

.contact-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.contact-buttons br { display: none; }
.contact-buttons .button-filled,
.contact-buttons .button-muted { margin-top: 1rem; }

.confidential-footer { background-color: #f5f5f5; padding: 1rem 1rem 1rem; text-align: center; }
.confidential-wrapper { max-width: 1000px; margin: 0 auto; padding-top: 3rem; color: #555; font-size: 0.8rem; line-height: 1.5; }
.confidential-wrapper p { font-size: 0.8rem; text-align: left; }

.scroll-down-container { display: flex; flex-direction: column; align-items: center; margin-top: 100px; }
.scroll-down-btn { background: transparent; border: none; cursor: pointer; display: flex; justify-content: center; align-items: center; animation: bounce 2s infinite; color: #aeaeae; width: 300px; }
.scroll-down-text { margin-top: 12px; font-size: 0.875rem; color: #666; text-align: center; }
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(8px); }
  60% { transform: translateY(4px); }
}

.modal img { width: 100%; height: auto; border-radius: 12px; margin-bottom: 2rem; }

.modal-content-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
}
.modal-content-wrapper h2 { margin-bottom: 0.5rem; }
.modal-content-wrapper p { margin-top: 0; }
.modal-content-wrapper.text-center { text-align: center; display: flex; flex-direction: column; align-items: center; }

#passwordGate {
  min-height: calc(100vh - var(--header-h, 57px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#passwordGate .modal-content-wrapper {
  flex: 0;
  min-height: auto;
  padding-top: 6rem;
  padding-bottom: 4rem;
  justify-content: flex-start;
  max-width: 1200px;
}
#passwordGate footer,
#passwordGate .confidential-footer,
#passwordGate .confidential-wrapper { background-color: transparent !important; }

a[href^="mailto"]:visited { color: var(--port-text, #2B2B2D); }

.input-password {
  padding: 0.9rem 1rem;
  font-size: 1.1rem;
  font-weight: 500;
  border: 1px solid #ccc;
  border-radius: 12px;
  width: 100%;
  box-sizing: border-box;
  margin-top: 1rem;
  margin-bottom: 0;
  display: block;
  min-height: 56px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  background: var(--bg-primary, #fcfcfc);
  line-height: 1.2;
  position: relative;
  z-index: 1;
}
.input-password:hover { border-color: #007bff; }
.input-password:not(:placeholder-shown):not(:focus) { border-color: #999; }
.input-password:focus { border-color: #007bff; box-shadow: 0 0 0 3px rgba(0,123,255,0.12); }
.input-password.input-error { border-color: #e53e3e !important; box-shadow: 0 0 0 3px rgba(229,62,62,0.12) !important; }
.input-password.input-error + .floating-label { color: #e53e3e !important; }
.input-password.input-error:hover { border-color: #e53e3e !important; }

.floating-label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--port-text-2, #999);
  pointer-events: none;
  transition: top 0.2s ease, transform 0.2s ease, font-size 0.2s ease, color 0.2s ease, letter-spacing 0.2s ease, font-weight 0.2s ease, background 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  padding: 0 4px;
  z-index: 0;
}
.input-password:focus + .floating-label {
  top: 0; transform: translateY(-50%); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px;
  color: var(--port-accent, #007bff); background: var(--bg-primary, #fcfcfc); z-index: 2;
}
.input-password:not(:placeholder-shown):not(:focus) + .floating-label {
  top: 0; transform: translateY(-50%); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px;
  color: var(--port-text, #2B2B2D); background: var(--bg-primary, #fcfcfc); z-index: 2;
}

button[onclick="checkPassword()"]:disabled { cursor: not-allowed; opacity: 0.3; pointer-events: none; }
button[onclick="checkPassword()"]:not(:disabled):hover { background: #007bff !important; }

.continue-btn { overflow: hidden; }
.continue-btn .continue-arrow { width: 0; opacity: 0; display: inline-flex; align-items: center; transition: width 0.3s ease, opacity 0.3s ease, margin 0.3s ease; margin-left: 0; overflow: hidden; }
.continue-btn:not(:disabled):hover .continue-arrow,
.continue-btn.has-value .continue-arrow { width: 18px; opacity: 1; margin-left: 8px; }
.continue-btn:not(:disabled):hover,
.continue-btn.has-value { padding-right: 20px; }
.continue-btn .button-text,
.continue-btn:hover .button-text { transform: none; }

#clearPasswordBtn:hover { background: rgba(0,0,0,0.15) !important; }
#clearPasswordBtn:hover svg { stroke: var(--port-text, #333); }

#showPasswordCheck {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #bbb;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  flex-shrink: 0;
  vertical-align: middle;
}
#showPasswordCheck:hover { border-color: #007bff; }
#showPasswordCheck:checked { background-color: #007bff; border-color: #007bff; }
#showPasswordCheck:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
#showPasswordCheck:checked:hover { background-color: #0056b3; border-color: #0056b3; }
#showPasswordCheck:focus-visible { box-shadow: 0 0 0 3px rgba(0,123,255,0.12); }

@media (max-width: 768px) {
  #passwordGate .modal-content-wrapper h2 { font-size: 2rem; }
  #passwordGate .modal-content-wrapper .contact-desc,
  #passwordGate .modal-content-wrapper > p { font-size: 0.9rem; }
}

@media (max-width: 480px) {
  #custom-header { padding: 12px 16px; }
  #passwordGate .modal-content-wrapper h2 { font-size: 1.6rem; }
  #passwordGate .modal-content-wrapper .contact-desc,
  #passwordGate .modal-content-wrapper > p { font-size: 1rem !important; }
  #passwordGate .modal-content-wrapper { padding: 2rem 16px; }
  #passwordGate .modal-content-wrapper > div { width: 100%; max-width: 100%; }
  .modal-content-wrapper { margin: 0 !important; }
  .grid-wrapper { padding: 2rem 16px; }
  section.grid-wrapper, #about, #contact { padding: 2rem 16px; }
  #case-studies { padding: 2rem 16px 4rem; }
  .confidential-footer { padding: 1rem 16px 6rem; }
  .confidential-wrapper { padding-left: 0; padding-right: 0; }
  .hero { padding: 60px 16px; }
  .contact-buttons { flex-direction: column; align-items: center; }
  .contact-buttons .button-filled,
  .contact-buttons .button-muted {
    min-width: 260px;
    max-width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
}

@media (max-width: 767px) {
  #passwordGate {
    min-height: auto;
  }
}

@media (max-width: 767px) {
  .header-center { display: none; }
  #theme-toggle { display: none !important; }
  .burger { display: block; }
  .mobile-menu { display: flex; flex-direction: column; padding: 2rem; position: fixed; top: var(--header-h, 60px); left: 0; width: 100%; background-color: rgba(252,252,252,0.95); backdrop-filter: blur(60px); -webkit-backdrop-filter: blur(60px); z-index: 999; }
  .mobile-menu.hidden { display: none !important; }
  .mobile-menu nav { display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin-bottom: 18px; }
  .mobile-menu nav a { display: block; margin: 6px 0; padding: 10px 16px; color: #666; font-weight: 400; font-size: 0.9rem; text-decoration: none; border-radius: 999px; transition: color 0.25s, background-color 0.3s; }
  .mobile-menu nav a:hover { color: #007bff; background-color: rgba(0,123,255,0.06); }
  #mobile-theme-toggle {
    display: flex; align-items: center; gap: 8px;
    width: auto; height: auto;
    background-color: transparent;
    border: 1px solid #e8e8e8; border-radius: 40px; color: #666;
    padding: 10px 18px; font-weight: 400; font-size: 0.85rem; cursor: pointer;
    transition: border-color 0.25s, color 0.25s;
    transform: none !important;
  }
  #mobile-theme-toggle .theme-svg { width: 15px; height: 15px; flex-shrink: 0; }
  #mobile-theme-toggle:hover { border-color: #007bff; color: #007bff; }
  #mobile-theme-toggle:hover .theme-svg { color: #007bff; }
  .hero { min-height: 80vh; padding: 80px; }
  .hero h1 { font-size: 2.6rem; }
  .animated-roles { font-size: 2.2rem; }
  .scroll-down-text, .scroll-down-btn { display: none; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 2rem; }
  .animated-roles { font-size: 1.4rem; }
}

body.dark-mode { background-color: #2B2B2D; color: #fff; }
body.dark-mode .theme-svg { color: #f1f1f1; }
body.dark-mode .theme-toggle { border-color: #5a5a5a; color: #f1f1f1; }
body.dark-mode .theme-toggle:hover { border-color: #4a9eff; }
body.dark-mode .nav-menu a { color: #999; }
body.dark-mode .nav-menu a:hover { color: #4a9eff; }
body.dark-mode .nav-menu a.active { color: #4a9eff; }
body.dark-mode .header-back-link { color: #999; }
body.dark-mode .header-back-link:hover { color: #4a9eff; }
body.dark-mode #custom-header { background-color: rgba(43,43,45,0.01); backdrop-filter: blur(60px); border-bottom: 1px solid rgba(90,90,90,0.5); }
body.dark-mode .full-width-section { background-color: #1a1a1a; }
body.dark-mode .animated-roles { color: #ccc; }
body.dark-mode .scroll-down-btn { filter: brightness(0) invert(1); }
body.dark-mode .scroll-down-text { color: #a8a8a8; }

body.dark-mode .card { background-color: #1f1f1f; outline: 16px solid #424242; }
body.dark-mode .card:hover { outline: 16px solid #449af7; }
body.dark-mode .card h3, body.dark-mode .card p { color: #f1f1f1; }
body.dark-mode .tag { background: #333; color: #ccc; }

body.dark-mode .button-filled { color: #333; background-color: #f5f5f5; border-color: #f5f5f5; }
body.dark-mode .button-filled:hover { background-color: #007bff; color: #fff; border-color: #007bff; }
body.dark-mode .button-muted { color: #fff; border: 4px solid #616161; border-radius: 40px; }
body.dark-mode .button-muted:hover { background-color: #007bff; color: #fff; border-color: #007bff; }

body.dark-mode footer { background-color: #1e1e20; color: #aaa; }
body.dark-mode .confidential-footer { background-color: #1e1e20; }
body.dark-mode .confidential-wrapper { color: #aaa; }

body.dark-mode .input-password { border-color: #444; color: #f1f1f1; }
body.dark-mode .input-password:not(:placeholder-shown):not(:focus) { border-color: #666; }
body.dark-mode .input-password:hover { border-color: #4a9eff; }
body.dark-mode .input-password:focus { border-color: #4a9eff; box-shadow: 0 0 0 3px rgba(74,158,255,0.15); }
body.dark-mode .floating-label { color: #888; }
body.dark-mode .input-password:focus + .floating-label { color: #4a9eff; }
body.dark-mode .input-password:not(:placeholder-shown):not(:focus) + .floating-label { color: #f1f1f1; }

body.dark-mode #clearPasswordBtn { background: rgba(255,255,255,0.1) !important; }
body.dark-mode #clearPasswordBtn svg { stroke: #bbb; }
body.dark-mode #clearPasswordBtn:hover { background: rgba(255,255,255,0.2) !important; }
body.dark-mode #clearPasswordBtn:hover svg { stroke: #fff; }

body.dark-mode label[for="showPasswordCheck"] { color: #ccc !important; }

body.dark-mode #showPasswordCheck { border-color: #666; }
body.dark-mode #showPasswordCheck:hover { border-color: #4a9eff; }
body.dark-mode #showPasswordCheck:checked { background-color: #4a9eff; border-color: #4a9eff; }
body.dark-mode #showPasswordCheck:checked::after { border-color: #fff; }
body.dark-mode #showPasswordCheck:checked:hover { background-color: #66b3ff; border-color: #66b3ff; }
body.dark-mode #showPasswordCheck:focus-visible { box-shadow: 0 0 0 3px rgba(74,158,255,0.15); }

body.dark-mode .burger { filter: brightness(0) invert(1); }

body.dark-mode #passwordGate h2 { color: #f1f1f1; }
body.dark-mode #passwordGate p { color: #999; }
body.dark-mode #passwordGate .modal-content-wrapper svg rect,
body.dark-mode #passwordGate .modal-content-wrapper svg path,
body.dark-mode #passwordGate .modal-content-wrapper svg line { stroke: #888; }
body.dark-mode #passwordGate .modal-content-wrapper svg circle { fill: #888; }
body.dark-mode #passwordGate div[style*="height:1px"] { background: rgba(255,255,255,0.12) !important; }
body.dark-mode #passwordGate a[href^="mailto"] { color: #f1f1f1 !important; }
body.dark-mode #passwordGate a[href^="mailto"]:hover { color: #4a9eff !important; }

@media (max-width: 767px) {
  body.dark-mode .mobile-menu nav a { color: #999; }
  body.dark-mode .mobile-menu nav a:hover { color: #4a9eff; background-color: rgba(74,158,255,0.08); }
  body.dark-mode .mobile-menu { background-color: rgba(43,43,45,0.95); backdrop-filter: blur(60px); }
  body.dark-mode #mobile-theme-toggle { border-color: #5a5a5a; color: #999; }
  body.dark-mode #mobile-theme-toggle:hover { border-color: #4a9eff; color: #4a9eff; }
  body.dark-mode #mobile-theme-toggle:hover .theme-svg { color: #4a9eff; }
}
