/* ==================================================================
   assets/styles.css
   ------------------------------------------------------------------
   themed to match macpanthor.com so this doesn't look like a
   different website. same palette, same fonts, same button shapes.

   tokens below are copied 1:1 from the portfolio's :root block, with
   a couple of extras added for the calculator bits (progress bar,
   answer well, warning colour).
   ================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

:root {
  /* ---- straight from the portfolio ---- */
  --bg-primary:    #0a0a0a;
  --bg-secondary:  #111111;
  --bg-card:       #1a1a1a;
  --text-primary:  #e0e0e0;
  --text-secondary:#a0a0a0;
  --accent:        #00bcd4;
  --accent-hover:  #26c6da;
  --accent-dim:    rgba(0, 188, 212, 0.1);
  --border-color:  #2a2a2a;
  --font-mono:     'Courier New', Courier, monospace;

  /* ---- extras for this page ---- */
  --danger:        #ff6b6b;
  --danger-dim:    rgba(255, 107, 107, 0.1);
  --warn:          #f59e0b;
  --warn-dim:      rgba(245, 158, 11, 0.12);
  --warn-border:   rgba(245, 158, 11, 0.3);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  padding: 0 20px 60px;
  overflow-x: hidden;

  /* same soft glow the hero section uses */
  background-image: radial-gradient(
    circle at 30% 0%,
    rgba(0, 188, 212, 0.05) 0%,
    transparent 55%
  );
  background-repeat: no-repeat;
}

/* same scrollbar as the portfolio */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
}


/* ==================================================================
   header
   ================================================================== */

.top {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 52px 0 28px;
}

.logo {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.toptext { min-width: 0; }

h1 {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;

  /* the portfolio's signature gradient heading */
  background: linear-gradient(135deg, #ffffff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.blurb {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 56ch;
}

.blurb strong {
  color: var(--accent);
  font-weight: 600;
}

/* "built by Shuaib Ahamad" under the header blurb */
.byline {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #555;
}

.byline a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-weight: 600;
  transition: color 0.3s ease;
}

.byline a:hover { color: var(--accent); }

.byline svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

/* the second one, at the bottom of the about tab */
.byline-foot {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}


/* ==================================================================
   tabs
   ================================================================== */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tabs button {
  position: relative;
  padding: 10px 15px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.tabs button:hover:not(.on) { color: var(--text-primary); }

.tabs button.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 4px;
}

/* the small grey "how does this work" */
.tabnote {
  margin-left: 6px;
  font-size: 0.78rem;
  font-weight: 400;
  color: #555;
}

.tabs button.on .tabnote { color: var(--accent); opacity: 0.7; }

[role=tabpanel]:focus { outline: none; }


/* ==================================================================
   boxes
   ================================================================== */

.box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
  transition: border-color 0.3s ease;
}

/* the "try 50000 + 50000" nudge above the form. clickable, because
   asking someone to type two numbers is asking too much. */
.trythis {
  margin-bottom: 16px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.trybtn {
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 188, 212, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.trybtn:hover {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}

.trybtn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.trynote { color: #555; }

.fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 15px;
  align-items: end;
}

.f { display: flex; flex-direction: column; gap: 7px; }

.f-op, .f-go { flex: none; }

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}


/* ---- number inputs ---- */

input[type=number] {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type=number]:hover:not(:disabled) { border-color: #3a3a3a; }

input[type=number]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input[type=number]:disabled {
  color: #555;
  cursor: not-allowed;
}

/* hide the spinners, they clash with the theme */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }


/* ---- the plus/minus pill ---- */

.op {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.op button {
  width: 46px;
  padding: 11px 0;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.op button:last-child { border-right: none; }

.op button:hover:not(.active):not(:disabled) {
  color: var(--accent);
  background: var(--accent-dim);
}

.op button.active {
  color: #0a0a0a;
  background: var(--accent);
  font-weight: 700;
}

.op button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.op button:disabled { opacity: 0.5; cursor: not-allowed; }

.note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #555;
}


/* ---- go button (matches .btn-primary) ---- */

.go {
  padding: 12px 28px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0a0a0a;
  background: var(--accent);
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.go:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 188, 212, 0.3);
}

.go:active:not(:disabled) { transform: translateY(-1px); }

.go:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.go:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.fineprint {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-secondary);
}


/* ==================================================================
   progress
   ================================================================== */

.progress {
  background: var(--bg-card);
  border: 0 solid var(--border-color);
  border-radius: 12px;
  padding: 0 24px;
  margin-bottom: 18px;

  /* collapsed until needed */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s linear, padding 0.3s ease;
}

.progress.visible {
  max-height: 160px;
  opacity: 1;
  padding: 20px 24px;
  border-width: 1px;
}

.plabel {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#progressPct {
  color: var(--accent);
  font-weight: 700;
}

.ptrack {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.pfill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(0, 188, 212, 0.5);
  transition: width 0.1s linear;
}

.pnote {
  margin-top: 10px;
  font-size: 0.8rem;
  font-style: italic;
  color: #555;
}


/* ==================================================================
   answer
   ================================================================== */

.rowlabel {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 12px;
}

#output {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;

  min-height: 64px;
  padding: 16px 18px;

  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--accent);

  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  word-break: break-word;

  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

#output.overflow {
  color: var(--warn);
  background: var(--warn-dim);
  border-color: var(--warn-border);
}

#output.error {
  color: var(--danger);
  background: var(--danger-dim);
  border-color: rgba(255, 107, 107, 0.4);
}

/* the sentence under the number */
.result-meta {
  flex-basis: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* blinking cursor, matches the portfolio's typewriter caret */
.caret {
  display: inline-block;
  width: 10px;
  height: 0.95em;
  background: var(--accent);
  animation: blink 0.7s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }


/* ==================================================================
   log
   ================================================================== */

.log {
  max-height: 130px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.log::-webkit-scrollbar { width: 6px; }
.log::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }


/* ==================================================================
   the write-up
   ================================================================== */

.notes { padding-top: 4px; }

.notes h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 40px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.notes h2:first-child { margin-top: 0; }

.notes p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 18px;
  max-width: 64ch;
}

.notes p em { color: var(--accent); font-style: normal; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 4px;
  white-space: nowrap;
}


/* ---- numbered steps ---- */

.steps {
  list-style: none;
  margin: 26px 0 0;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 0 0 28px 48px;
  counter-increment: step;
}

/* the number bubble in accent, same as the portfolio's category titles */
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #0a0a0a;
  background: var(--accent);
  border-radius: 50%;
}

/* dotted line joining the steps */
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15.5px;
  top: 38px;
  bottom: 4px;
  width: 1px;
  background: repeating-linear-gradient(
    to bottom,
    var(--border-color) 0 4px,
    transparent 4px 8px
  );
}

.steps h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  margin: 6px 0 8px;
}

.steps p {
  font-size: 0.95rem;
  margin-bottom: 14px;
}


/* ---- code blocks (dark well, like the portfolio's project stats) ---- */

.code {
  padding: 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.code code {
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}


/* ---- the bug callout ---- */

.bug {
  padding: 16px 18px;
  background: var(--warn-dim);
  border-left: 3px solid var(--warn);
  border-radius: 0 8px 8px 0;
  color: var(--text-primary) !important;
  line-height: 1.8;
}

.bug code {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
}


/* ---- details list ---- */

.details {
  list-style: none;
  border-top: 1px solid var(--border-color);
}

.details li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.92rem;
}

.details span {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
}


/* ---- back link ---- */

.backlink { margin-top: 34px; }

.linkish {
  padding: 0;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

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


/* ==================================================================
   footer (matches the portfolio footer)
   ================================================================== */

footer {
  margin-top: 60px;
  padding: 30px 0 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

footer p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tiny {
  margin-top: 10px !important;
  font-size: 0.8rem;
  color: #555;
  font-style: italic;
}

.footer-socials {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.footer-socials a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: color 0.3s ease, transform 0.3s ease;
}

.footer-socials a:hover {
  color: var(--accent);
  transform: translateY(-3px);
}

.footer-socials svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}


/* ==================================================================
   responsive
   ================================================================== */

@media (max-width: 768px) {
  .wrap { max-width: 100%; }
  h1 { font-size: 1.6rem; }
}

@media (max-width: 640px) {
  body { padding: 0 16px 48px; }

  .top { padding: 36px 0 24px; gap: 14px; }
  .logo { width: 44px; height: 44px; }
  h1 { font-size: 1.4rem; }

  /* stack the form rather than squeezing it */
  .fields { grid-template-columns: 1fr; }

  .op { width: 100%; }
  .op button { flex: 1; width: auto; }

  .go { width: 100%; }

  #output { font-size: 1.7rem; }

  .notes h2 { font-size: 1.25rem; }
  .steps li { padding-left: 42px; }
}


/* ==================================================================
   reduced motion
   ================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .caret { animation: none; }
  .go:hover:not(:disabled) { transform: none; }
  .footer-socials a:hover { transform: none; }
}


/* ==================================================================
   forced colors
   ================================================================== */

@media (forced-colors: active) {
  .op button.active,
  .go,
  .steps li::before,
  .pfill { forced-color-adjust: none; }

  .caret { background: CanvasText; animation: none; }
}
