/* Theme variables (default = dark) */
:root{
  --bg: #0f1112;
  --panel: #141516;
  --surface: #1e1e1e;
  --text: #eaeaea;
  --muted: #9aa0a6;
  --accent: #00ffd5;
  --accent2: #00f7ff;
  --btn-bg: rgba(255,255,255,0.03);
  --btn-border: rgba(255,255,255,0.06);
  --shadow: rgba(0,0,0,0.5);
}

/* Light theme */
body.light-mode {
  --bg: #e8ebef;
  --panel: #f4f6fa;
  --surface: #eff2f7;
  --text: #1f2430;
  --muted: #6f7787;
  --accent: #3b82f6;
  --accent2: #2563eb;
  --btn-bg: rgba(0,0,0,0.03);
  --btn-border: rgba(0,0,0,0.08);
  --shadow: rgba(0,0,0,0.08);
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* smooth transitions */
* { box-sizing: border-box; transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease, transform 200ms ease; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Header */
header {
  background: var(--surface);
  text-align: center;
  padding: 36px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}
header h1 { margin: 0 0 6px 0; font-size: 2.2rem; color: var(--accent2); }
header p { margin: 0; color: var(--muted); }

/* Layout */
main { max-width: 920px; margin: 28px auto; padding: 0 18px; }
section { padding: 24px 0; border-bottom: 1px dashed rgba(255,255,255,0.02); }
h2 { margin: 0 0 12px 0; color: var(--accent); border-bottom: 2px solid transparent; padding-bottom: 6px; }

/* Cards/list */
.project, ul li {
  background: var(--panel);
  color: var(--text);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.02);
}

.calculator {
  max-width: 280px;
  margin: 12px auto 0 auto;
}
.calculator input {
  width: 100%;
  min-height: 48px;
  text-align: right;
  padding: 10px 12px;
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  margin-bottom: 8px;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.calc-btn {
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  font-size: clamp(1rem, 2.5vw, 1.05rem);
  border-radius: 8px;
  min-height: 48px;
  cursor: pointer;
}
.calc-btn:hover {
  background: rgba(0, 255, 213, 0.15);
}
.calc-btn.operator {
  background: rgba(0, 119, 204, 0.12);
}
.calc-btn.equal {
  grid-column: span 4;
  background: var(--accent);
  color: #070a0d;
  font-weight: 700;
}

/* Links & highlights */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.highlight-name { color: var(--accent2); font-weight: 700; }
.highlight-skill { color: var(--accent); font-weight: 700; }

/* Skills ring */
.skills-container { display:flex; gap:18px; flex-wrap:wrap; justify-content:center; }
.skill { text-align:center; min-width:80px; }
.ring-bg, .ring-fill { fill:none; stroke-width:10; }
.ring-bg { stroke: var(--btn-border); }
.ring-fill { stroke: var(--accent); opacity: 0.96; transition: stroke-dashoffset 1s ease-out, stroke 300ms; transform-origin: 60px 60px; }
.ring-text { fill: var(--text); font-size: 18px; text-anchor: middle; dominant-baseline: middle; transform: none; transform-origin: 60px 60px; }

/* Weather demo */
#weather-location { padding-bottom: 12px; }

.weather-demo {
  background: var(--panel);
  color: var(--text);
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.02);
}

.weather-demo-subtitle {
  margin: 0 0 14px 0;
  color: var(--muted);
}

.weather-demo-btn {
  background: var(--btn-bg);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 170ms ease, background-color 200ms ease, border-color 200ms ease;
  width: 100%;
  max-width: 340px;
  margin-top: 10px;
}

.weather-demo-btn:hover {
  background: rgba(0, 255, 213, 0.15);
  transform: translateY(-1px);
}

.weather-demo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.weather-demo-panel {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 14px;
}

.weather-demo-panel pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0 0 0;
  font-size: 0.95rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.weather-demo-panel .label {
  font-weight: 800;
  color: var(--accent);
  font-size: 0.95rem;
}

.weather-demo-panel--wide {
  grid-column: 1 / -1;
}

.weather-demo-note {
  margin: 12px 0 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.error-text {
  color: #fda4af;
  font-weight: 700;
}

/* Light tweaks */
body.light-mode .weather-demo-btn {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.16);
}

body.light-mode .weather-demo-panel {
  border: 1px solid rgba(0,0,0,0.08);
}

/* Responsive weather grid */
@media (min-width: 720px) {
  .weather-demo-grid { grid-template-columns: 1fr 1fr; }
  .weather-demo-panel--wide { grid-column: 1 / -1; }
}

/* Contact */
#contact { text-align:center; }
.contact-links { display:inline-flex; gap:18px; align-items:center; }
.contact-links a { position: relative; }
.contact-links a::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
  z-index: 10;
}
.contact-links a:hover::after,
.contact-links a:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.email-icon, .fb-icon { width:30px; height:30px; }

/* Theme toggle button */
.theme-toggle-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1200;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.38);
  background: linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02));
  color: #fff;
  box-shadow: 0 8px 16px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(255,255,255,0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.theme-toggle-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 20px rgba(0,0,0,0.34), inset 0 0 0 1px rgba(255,255,255,0.2);
}
.theme-toggle-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.95);
  outline-offset: 3px;
}
.theme-toggle-btn.light-mode {
  background: linear-gradient(145deg, rgba(40, 116, 252, 0.94), rgba(125, 211, 252, 0.9));
  color: #0f172a;
}
.theme-toggle-btn.dark-mode {
  background: linear-gradient(145deg, rgba(75, 85, 99, 0.9), rgba(37, 99, 235, 0.75));
  color: #f8fafc;
}
.toggle-icon {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
  transform-origin:center;
  transition: transform 260ms cubic-bezier(.2,.9,.3,1), background 220ms ease;
}
.theme-toggle-btn.btn-anim .toggle-icon {
  transform: rotate(-20deg) scale(1.08);
  background: rgba(255,255,255,0.26);
}

/* Scroll top button */
.fixed-scroll-top {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--accent);
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 8px 16px rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 260ms ease, transform 170ms ease, box-shadow 170ms ease, filter 170ms ease;
  cursor: pointer;
}
body.light-mode .fixed-scroll-top {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.65);
  color: #0ea5e9;
  box-shadow: 0 8px 18px rgba(0,0,0,0.2);
}
.fixed-scroll-top:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 11px 20px rgba(0,0,0,0.25);
  filter: brightness(1.02);
}
.fixed-scroll-top:focus-visible {
  outline: 2px solid rgba(255,255,255,0.95);
  outline-offset: 2px;
}
.scroll-top-icon {
  font-size: 1.35rem;
  line-height: 1;
  display: inline-block;
  transform: translateY(-1px);
  color: currentColor;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.fixed-scroll-top:hover .scroll-top-icon,
.fixed-scroll-top:focus-visible .scroll-top-icon {
  transform: translateY(-2px) scale(1.1);
  transition: transform 160ms ease;
}

/* Footer */
footer { text-align:center; padding:18px; color:var(--muted); background:transparent; }

/* Responsive */
@media (max-width:600px) {
  header h1 { font-size:1.5rem; }
  .skills-container { gap:12px; }
  .calculator {
    max-width: min(100%, 320px);
  }
  .calculator input,
  .calc-btn {
    min-height: 52px;
  }
  .weather-demo-btn {
    max-width: 100%;
  }
}
