/* ============================================================
   REFINED EMBER — Brand System v1.0
   Aleksei Lopatin · alekseilopatin.com
   ============================================================ */

:root {
  /* --- Backgrounds --- */
  --color-base:          #141210;
  --color-surface:       #201c18;
  --color-elevated:      #2c2620;

  /* --- Accent (gold) --- */
  --color-accent:        #d4a44b;
  --color-accent-hover:  #e8b85c;
  --color-accent-muted:  rgba(212, 164, 75, 0.15);
  --color-on-accent:     #141210;

  /* --- Text --- */
  --color-text:          #e8dcc8;
  --color-text-muted:    #a09080;
  --color-text-faint:    #5a4e42;

  /* --- Borders --- */
  --color-border:        #3a3020;
  --color-border-accent: rgba(212, 164, 75, 0.25);
  --color-border-strong: #5a4e42;

  /* --- Semantic --- */
  --color-success:       #7c9a52;
  --color-error:         #d4614f;

  /* --- Typography --- */
  --font-heading:        'Raleway', sans-serif;
  --font-body:           'Poppins', sans-serif;

  /* --- Transitions & shadows --- */
  --transition:          200ms ease;
  --shadow-sm:           0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:           0 4px 12px rgba(0, 0, 0, 0.5);

  /* Legacy aliases (kept for sub-pages not yet updated) */
  --main-white: #e8dcc8;
  --main-gold:  #d4a44b;
  --main-black: #141210;
  --main-gray:  rgba(0, 0, 0, 0.5);
}

/* Base reset */
* {
  margin: 0;
  padding: 0;
}

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

html {
  box-sizing: border-box;
  font-size: 62.5%;
  scroll-behavior: smooth;
}

/* Responsive font scaling */
@media (max-width: 75em) {
  html { font-size: 60%; }
}

@media (max-width: 61.25em) {
  html { font-size: 58%; }
}

@media (max-width: 28.75em) {
  html { font-size: 55%; }
}

/* Base styles */
body {
  font-family: var(--font-body);
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text);
  background: var(--color-base);
}

h1, h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  text-align: center;
}

h1 { font-size: 6rem; }
h2 { font-size: 4.2rem; }

ul { list-style: none; }

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

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

/* ============================================================
   NAV
============================================================ */

.nav {
  display: flex;
  justify-content: flex-end;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--color-accent);
  box-shadow: 0 2px 0 var(--color-border);
  z-index: 10;
}

.header-img {
  display: block;
  height: 7rem;
  width: auto;
  padding: 0.5rem;
  position: absolute;
  left: 0;
  z-index: 11;
}

.nav-list {
  display: flex;
  margin-right: 2rem;
}

@media (max-width: 28.75em) {
  .nav { justify-content: center; }
  .nav-list { margin: 0 1rem; }
}

.nav-list a {
  display: block;
  font-size: 2.2rem;
  padding: 2rem;
  color: var(--color-on-accent);
  transition: background var(--transition), color var(--transition);
}

.nav-list a:hover {
  background: var(--color-elevated);
  color: var(--color-accent);
}

/* ============================================================
   WELCOME SECTION
============================================================ */

.welcome-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  background: var(--color-base);
  background-image: linear-gradient(20deg, var(--color-surface) 0%, var(--color-base) 100%);
}

.welcome-section .content p {
  font-size: 3rem;
  font-weight: 200;
  font-style: italic;
  color: var(--color-accent);
}

.welcome-section .bio {
  font-size: 1.6rem;
  font-weight: 300;
  font-style: normal;
  color: var(--color-text);
  max-width: 600px;
  margin-top: 2.5rem;
  line-height: 1.7;
  opacity: 0.85;
}

.welcome-image {
  max-width: 40%;
  height: auto;
  max-height: 600px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  margin-top: 2rem;
}

/* Bubble animation */
.welcome-section .bubbles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.welcome-section .content {
  position: relative;
  z-index: 10;
  color: var(--color-text);
  text-align: center;
  font-size: 2rem;
}

.bubble {
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 10px;
  background: rgba(212, 164, 75, 0.2);
  border-radius: 50%;
  animation: rise 5s infinite ease-in-out;
}

@keyframes rise {
  0%   { transform: translateY(0) scale(1);      opacity: 0.6; }
  50%  { transform: translateY(-50vh) scale(1.2); opacity: 0.3; }
  100% { transform: translateY(-100vh) scale(0.8); opacity: 0; }
}

.bubble:nth-child(1) { left: 10%; animation-duration: 4s; animation-delay: 0s; }
.bubble:nth-child(2) { left: 20%; animation-duration: 5s; animation-delay: 1s; }
.bubble:nth-child(3) { left: 30%; animation-duration: 6s; animation-delay: 2s; }
.bubble:nth-child(4) { left: 40%; animation-duration: 7s; animation-delay: 1s; }
.bubble:nth-child(5) { left: 50%; animation-duration: 4s; animation-delay: 3s; }
.bubble:nth-child(6) { left: 60%; animation-duration: 5s; animation-delay: 2s; }
.bubble:nth-child(7) { left: 70%; animation-duration: 6s; animation-delay: 0s; }
.bubble:nth-child(8) { left: 80%; animation-duration: 7s; animation-delay: 2s; }
.bubble:nth-child(9) { left: 90%; animation-duration: 4s; animation-delay: 1s; }

/* ============================================================
   PROJECTS SECTION
============================================================ */

.projects-section {
  text-align: center;
  padding: 10rem 2rem;
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 88vh;
}

.projects-section-header {
  max-width: 640px;
  margin: 0 auto 6rem auto;
  border-bottom: 0.2rem solid var(--color-border);
  color: var(--color-text);
}

@media (max-width: 28.75em) {
  .projects-section-header { font-size: 4rem; }
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  grid-gap: 2.4rem;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  margin-bottom: 6rem;
}

@media (max-width: 30.625em) {
  .projects-section { padding: 6rem 1rem; }
  .projects-grid { grid-template-columns: 1fr; }
}

.project {
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  border-radius: 6px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

iframe {
  border-radius: 6px;
  width: 100%;
  max-width: 1280px;
}

.project:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--color-border-strong);
}

.hover-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 6.8rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  color: var(--color-text);
  font-size: 1.6rem;
  font-weight: 300;
  text-align: center;
  background: rgba(20, 18, 16, 0.82);
  transition: opacity 0.4s ease-in-out;
  pointer-events: none;
}

.hover-image {
  height: calc(100% - 6.8rem);
  width: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease-in-out;
}

.project:hover .hover-image { opacity: 0; }
.project:hover .hover-text  { opacity: 1; }

.project-image {
  height: calc(100% - 6.8rem);
  width: 100%;
  object-fit: cover;
}

.code {
  color: var(--color-accent);
  transition: color var(--transition);
}

.project:hover .code { color: var(--color-accent-hover); }

.project-title {
  font-size: 2rem;
  padding: 2rem 0.5rem;
  color: var(--color-text-muted);
}

.btn {
  display: inline-block;
  padding: 1rem 2rem;
  border-radius: 3px;
}

.btn-show-all {
  font-size: 2rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-show-all:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   CONTACT SECTION
============================================================ */

.contact-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  height: 82vh;
  padding: 0 2rem;
  background: var(--color-base);
  border-top: 1px solid var(--color-border);
}

.contact-section-header > h2 {
  font-size: 6rem;
  color: var(--color-text);
}

@media (max-width: 28.75em) {
  .contact-section-header > h2 { font-size: 4rem; }
}

.contact-section-header > p {
  font-style: italic;
  color: var(--color-text-muted);
}

.contact-links {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 980px;
  margin-top: 4rem;
  flex-wrap: wrap;
}

.contact-details {
  font-size: 2.4rem;
  color: var(--color-text-muted);
  transition: color var(--transition), transform var(--transition);
}

.contact-details:hover {
  color: var(--color-accent);
  transform: translateY(-4px);
}

/* ============================================================
   PROJECTS CTA
============================================================ */

.projects-cta {
  text-align: center;
  padding: 6rem 2rem;
  background: var(--color-base);
  border-top: 3px solid var(--color-accent);
}

.projects-cta h2 {
  color: var(--color-text);
  margin-bottom: 1.5rem;
}

.projects-cta p {
  color: var(--color-text-muted);
  margin-bottom: 3rem;
  font-style: italic;
}

.btn-contact {
  font-size: 2rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: 1.2rem 3rem;
  border-radius: 3px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  font-weight: 400;
}

.btn-contact:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  color: var(--color-on-accent);
}

/* ============================================================
   FOOTER
============================================================ */

.footer {
  font-weight: 300;
  display: flex;
  justify-content: space-evenly;
  padding: 2rem;
  background: var(--color-surface);
  border-top: 3px solid var(--color-accent);
  color: var(--color-text-muted);
}

.footer > p { margin: 2rem; }

/* ============================================================
   UTILITY
============================================================ */

.hide {
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 1s ease-out, transform 1s ease-out, visibility 1s;
}
