/* =========================================================
   ITB Web Solutions
   The site writes itself: source types on the left, the real
   page (including the working contact form) assembles right.
   ========================================================= */

:root {
  --cream:  #fdf6ec;
  --ink:    #3a2d25;
  --body:   #6a584d;
  --muted:  #9a8b7f;
  --line:   #e7dccd;
  --accent: #e2674a;
  --accent-d: #c9502f;

  --code-bg: #2b211b;
  --code-fg: #e9dccd;
  --code-dim:#8d7b6c;
  --c-tag:   #ef8a6b;
  --c-atr:   #e8b06a;
  --c-str:   #b6d19b;

  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0; background: var(--cream); color: var(--body);
  font-family: var(--sans); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
h1 { font-family: var(--sans); color: var(--ink); font-weight: 600; margin: 0; line-height: 1.2; letter-spacing: -.02em; font-size: clamp(1.6rem, 2.7vw, 2.05rem); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

/* ---------- the editor ---------- */
.ide {
  flex: 1 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 0; margin: clamp(20px, 3vw, 30px) clamp(18px, 4vw, 34px);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 34px 70px -46px rgba(90,55,35,.6);
  background: var(--code-bg);
}
.pane-head {
  display: flex; align-items: center; gap: .5rem; padding: 12px 16px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; flex: 0 0 auto;
}
.pane-head .name { letter-spacing: .05em; }

/* left: code */
.code-pane { background: var(--code-bg); display: flex; flex-direction: column; min-width: 0; }
.code-pane .pane-head { color: var(--code-dim); border-bottom: 1px solid rgba(255,255,255,.07); }
.skip {
  margin-left: auto; font-family: var(--mono); font-size: .7rem; letter-spacing: .04em;
  color: var(--code-dim); background: none; border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px; padding: .2rem .6rem; cursor: pointer; transition: color .2s, border-color .2s;
}
.skip:hover { color: var(--code-fg); border-color: rgba(255,255,255,.4); }
html:not(.building) .skip { visibility: hidden; }
.code-body {
  margin: 0; padding: 18px 20px 24px; flex: 1; min-width: 0; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  color: var(--code-fg); white-space: pre-wrap; word-break: break-word;
}
.code-body .tag { color: var(--c-tag); }
.code-body .atr { color: var(--c-atr); }
.code-body .str { color: var(--c-str); }
.caret { display: inline-block; width: 7px; height: 1.05em; vertical-align: -.16em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
html:not(.building) .caret { display: none; }

/* right: the real site */
.site-pane { background: var(--cream); display: flex; flex-direction: column; min-width: 0; }
.site-pane .pane-head { color: var(--muted); border-bottom: 1px solid var(--line); }
/* Content flows from the top and can scroll — centring used to push the
   submit button out of the pane on shorter screens, where it was clipped. */
.site-body {
  flex: 1; padding: clamp(24px, 3vw, 34px);
  display: flex; flex-direction: column; justify-content: flex-start;
}
.site-body .sub { color: var(--body); margin: .8rem 0 1.35rem; max-width: 44ch; }

/* pieces appear as the code writes them */
.building .step { opacity: 0; transform: translateY(10px); }
.step.in { opacity: 1; transform: none; transition: opacity .45s var(--ease), transform .45s var(--ease); }

/* ---------- form ---------- */
form { display: grid; gap: .95rem; max-width: 460px; }
.field label { display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.req { color: var(--accent); }
.field input, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 1.02rem; color: var(--ink);
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: .42rem 0; transition: border-color .2s var(--ease);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: none; overflow: hidden; }
button[type=submit] {
  justify-self: start; font-family: var(--sans); font-size: 1rem; font-weight: 500;
  color: #fff; background: var(--accent); border: 0;
  border-radius: 999px; padding: .72rem 1.5rem; cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
button[type=submit]:hover { background: var(--accent-d); transform: translateY(-1px); }
button[type=submit]:disabled { opacity: .6; cursor: default; transform: none; }
.note { font-size: .97rem; color: var(--body); }
.note:empty { display: none; }
.note.err { color: #a8452b; }

@media (min-height: 820px) { .ide { min-height: 560px; } }

/* ---------- responsive ---------- */

/* tablets and below: the two panes stack, code on top */
@media (max-width: 900px) {
  .ide {
    grid-template-columns: minmax(0, 1fr); min-height: 0;
    margin: clamp(12px, 2.5vw, 22px); border-radius: 13px;
  }
  .code-pane { max-height: 230px; }
  .code-body { font-size: 12px; line-height: 1.65; padding: 14px 16px 18px; }
  .site-body { padding: 26px 22px 30px; }
  form { max-width: none; }
}

/* phones */
@media (max-width: 620px) {
  body { font-size: 16px; }
  .ide { margin: 10px; border-radius: 12px; }
  .pane-head { padding: 9px 13px; font-size: .66rem; }
  .code-pane { max-height: 172px; }
  .code-body { font-size: 11px; line-height: 1.6; padding: 12px 14px 16px; }
  .site-body { padding: 22px 18px 26px; }
  h1 { font-size: 1.5rem; line-height: 1.25; }
  .site-body .sub { font-size: .97rem; margin: .7rem 0 1.2rem; }
  form { gap: .85rem; }
  .field input, .field textarea { font-size: 16px; }  /* stops iOS zooming on focus */
  /* a full-width tap target reads better than a small pill on a phone */
  button[type=submit] { justify-self: stretch; width: 100%; padding: .85rem 1rem; }
  .note { font-size: .92rem; }
}

/* very narrow phones */
@media (max-width: 380px) {
  .ide { margin: 8px; }
  .code-pane { max-height: 150px; }
  .code-body { font-size: 10.5px; }
  h1 { font-size: 1.38rem; }
  .site-body { padding: 20px 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .building .step { opacity: 1; transform: none; }
}
