How to design a beautiful analog wrist watch using html, CSS and JavaScript

Key Highlights:

  • ​Horological Craftsmanship: Features a brushed stainless-steel bezel, integrated lugs, fluted crown, domed sapphire crystal glare, faceted 3D Dauphine hands with Super-LumiNova inlays, and 300 precision outer track markers.
  • ​Dynamic Directional Shadows: Each hand casts a realistic, blurred drop shadow onto the dial whose offset shifts dynamically as the hand rotates relative to the studio light source.
  • ​Movement & Complications: Toggle between a 28,800 vph Mechanical Sweep and a 1 Hz Quartz Tick, cycle the recessed Date Aperture between 3 o'clock, 6 o'clock, or hidden, and toggle a GMT / Timezone Digital Readout.
  • ​Curated Dial Themes & Acoustics: Switch between Midnight Obsidian, Classic Silver Sunburst, Emerald Forest, Warm Champagne, and Deep Marine Blue, plus an optional Web Audio API escapement tick sound.


<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <title>Chronomètre Suisse — Luxury Analog Timepiece</title>

  <link rel="preconnect" href="https://fonts.googleapis.com" />

  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

  <link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />

  <style>

    :root {

      --bg-outer: #0b0d11;

      --bg-inner: #171b24;

      --dial-base: #10141c;

      --dial-sunburst-1: #1e2533;

      --dial-sunburst-2: #0a0d13;

      --accent-gold: #d4af37;

      --accent-gold-light: #f3e5ab;

      --accent-gold-dark: #8c6d1f;

      --second-hand: #d93829;

      --text-primary: #f1f5f9;

      --text-muted: #94a3b8;

      --lume-color: #a7f3d0;

      --lume-glow: rgba(52, 211, 153, 0.45);

      --glass-panel: rgba(20, 24, 33, 0.72);

      --glass-border: rgba(255, 255, 255, 0.09);

      --case-steel-1: #e2e8f0;

      --case-steel-2: #94a3b8;

      --case-steel-3: #475569;

    }


    /* Dial Themes */

    body[data-theme="obsidian"] {

      --dial-base: #0e1117;

      --dial-sunburst-1: #1e2430;

      --dial-sunburst-2: #07090d;

      --accent-gold: #d4af37;

      --accent-gold-light: #f5e6ad;

      --accent-gold-dark: #8a6c1b;

      --second-hand: #e03c2d;

      --text-primary: #f8fafc;

      --text-muted: #94a3b8;

    }


    body[data-theme="silver"] {

      --dial-base: #e2e6ec;

      --dial-sunburst-1: #ffffff;

      --dial-sunburst-2: #cbd2dc;

      --accent-gold: #1e293b;

      --accent-gold-light: #475569;

      --accent-gold-dark: #0f172a;

      --second-hand: #b91c1c;

      --text-primary: #0f172a;

      --text-muted: #475569;

    }


    body[data-theme="emerald"] {

      --dial-base: #062419;

      --dial-sunburst-1: #0e4733;

      --dial-sunburst-2: #03140e;

      --accent-gold: #dfb852;

      --accent-gold-light: #faecc3;

      --accent-gold-dark: #947422;

      --second-hand: #e04f3e;

      --text-primary: #ecfdf5;

      --text-muted: #6ee7b7;

    }


    body[data-theme="champagne"] {

      --dial-base: #dfd1b8;

      --dial-sunburst-1: #f5ecd9;

      --dial-sunburst-2: #c4b293;

      --accent-gold: #78551a;

      --accent-gold-light: #a67c33;

      --accent-gold-dark: #452e09;

      --second-hand: #991b1b;

      --text-primary: #291d0a;

      --text-muted: #6b532e;

    }


    body[data-theme="marine"] {

      --dial-base: #0a1930;

      --dial-sunburst-1: #163563;

      --dial-sunburst-2: #050d1a;

      --accent-gold: #e2e8f0;

      --accent-gold-light: #ffffff;

      --accent-gold-dark: #94a3b8;

      --second-hand: #f97316;

      --text-primary: #f8fafc;

      --text-muted: #93c5fd;

    }


    * {

      box-sizing: border-box;

      margin: 0;

      padding: 0;

      user-select: none;

    }


    body {

      min-height: 100vh;

      display: flex;

      flex-direction: column;

      align-items: center;

      justify-content: center;

      background: radial-gradient(circle at 50% 35%, var(--bg-inner) 0%, var(--bg-outer) 78%);

      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

      color: #f8fafc;

      overflow-x: hidden;

      padding: 24px 16px;

      gap: 28px;

    }


    /* Ambient Studio Spotlight */

    body::before {

      content: "";

      position: fixed;

      inset: 0;

      background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.04) 0%, transparent 55%);

      pointer-events: none;

    }


    /* Watch Case & Lugs Wrapper */

    .watch-stage {

      position: relative;

      display: flex;

      align-items: center;

      justify-content: center;

      width: min(88vw, 460px);

      aspect-ratio: 1 / 1;

      filter: drop-shadow(0 32px 55px rgba(0, 0, 0, 0.78))

              drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));

      transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);

    }


    /* Integrated Stainless Steel Lugs */

    .lugs {

      position: absolute;

      inset: -7% 17%;

      z-index: 0;

      display: flex;

      flex-direction: column;

      justify-content: space-between;

      pointer-events: none;

    }


    .lug-pair {

      display: flex;

      justify-content: space-between;

      height: 18%;

    }


    .lug {

      width: 15%;

      height: 100%;

      background: linear-gradient(90deg, #64748b 0%, #e2e8f0 35%, #94a3b8 70%, #334155 100%);

      box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 4px 10px rgba(0, 0, 0, 0.6);

    }


    .lug-pair.top .lug:first-child {

      border-radius: 14px 4px 0 0;

      transform: skewX(-7deg);

    }

    .lug-pair.top .lug:last-child {

      border-radius: 4px 14px 0 0;

      transform: skewX(7deg);

    }

    .lug-pair.bottom .lug:first-child {

      border-radius: 0 0 4px 14px;

      transform: skewX(7deg);

    }

    .lug-pair.bottom .lug:last-child {

      border-radius: 0 0 14px 4px;

      transform: skewX(-7deg);

    }


    /* Fluted Winding Crown at 3 o'clock */

    .crown {

      position: absolute;

      right: -4.2%;

      top: 50%;

      transform: translateY(-50%);

      width: 5.2%;

      height: 13.5%;

      z-index: 0;

      border-radius: 3px 6px 6px 3px;

      background: repeating-linear-gradient(

        to bottom,

        #cbd5e1 0px,

        #f8fafc 2px,

        #475569 4px,

        #94a3b8 6px

      );

      box-shadow:

        inset -2px 0 4px rgba(0, 0, 0, 0.45),

        4px 4px 10px rgba(0, 0, 0, 0.65);

    }


    .crown::before {

      content: "";

      position: absolute;

      left: -25%;

      top: 15%;

      width: 30%;

      height: 70%;

      background: linear-gradient(to bottom, #64748b, #cbd5e1, #334155);

      border-radius: 2px 0 0 2px;

    }


    /* Outer Polished & Brushed Bezel */

    .watch-bezel {

      position: relative;

      z-index: 1;

      width: 100%;

      height: 100%;

      border-radius: 50%;

      padding: 5.2%;

      background: conic-gradient(

        from 215deg,

        #cbd5e1 0deg,

        #475569 42deg,

        #f8fafc 95deg,

        #64748b 145deg,

        #e2e8f0 205deg,

        #334155 265deg,

        #f1f5f9 315deg,

        #cbd5e1 360deg

      );

      box-shadow:

        inset 0 2px 3px rgba(255, 255, 255, 0.75),

        inset 0 -3px 6px rgba(15, 23, 42, 0.8),

        0 0 0 1.5px rgba(15, 23, 42, 0.85);

      display: flex;

      align-items: center;

      justify-content: center;

    }


    /* Inner Chamfered Bezel Ring */

    .bezel-chamfer {

      width: 100%;

      height: 100%;

      border-radius: 50%;

      padding: 1.6%;

      background: conic-gradient(

        from 35deg,

        #334155 0deg,

        #f8fafc 75deg,

        #475569 155deg,

        #e2e8f0 235deg,

        #1e293b 310deg,

        #334155 360deg

      );

      box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.75);

      display: flex;

      align-items: center;

      justify-content: center;

    }


    /* Watch Dial */

    .watch-dial {

      position: relative;

      width: 100%;

      height: 100%;

      border-radius: 50%;

      overflow: hidden;

      background:

        conic-gradient(

          from 0deg at 50% 50%,

          var(--dial-sunburst-2) 0deg,

          var(--dial-sunburst-1) 38deg,

          var(--dial-sunburst-2) 85deg,

          var(--dial-sunburst-1) 142deg,

          var(--dial-sunburst-2) 195deg,

          var(--dial-sunburst-1) 248deg,

          var(--dial-sunburst-2) 305deg,

          var(--dial-sunburst-1) 338deg,

          var(--dial-sunburst-2) 360deg

        );

      box-shadow:

        inset 0 0 26px rgba(0, 0, 0, 0.75),

        inset 0 2px 8px rgba(0, 0, 0, 0.85);

      transition: background 0.45s ease;

    }


    /* Subtle Radial Vignette on Dial */

    .watch-dial::before {

      content: "";

      position: absolute;

      inset: 0;

      border-radius: 50%;

      background: radial-gradient(circle at 50% 50%, transparent 56%, rgba(0, 0, 0, 0.42) 100%);

      pointer-events: none;

      z-index: 2;

    }


    /* SVG Dial Markings & Hands Layer */

    .dial-svg {

      position: relative;

      z-index: 3;

      width: 100%;

      height: 100%;

      display: block;

    }


    /* Brand Typography on Dial */

    .brand-signature {

      font-family: 'Cinzel', serif;

      font-weight: 700;

      letter-spacing: 0.19em;

      fill: var(--text-primary);

      transition: fill 0.4s ease;

    }


    .brand-sub {

      font-family: 'Inter', sans-serif;

      font-weight: 500;

      letter-spacing: 0.26em;

      fill: var(--text-muted);

      transition: fill 0.4s ease;

    }


    .chronometer-cert {

      font-family: 'Inter', sans-serif;

      font-weight: 500;

      letter-spacing: 0.16em;

      fill: var(--text-muted);

      transition: fill 0.4s ease;

    }


    /* Recessed Date Window */

    .date-aperture {

      position: absolute;

      top: 50%;

      right: 17.5%;

      transform: translateY(-50%);

      z-index: 4;

      width: 10.2%;

      height: 7.4%;

      background: linear-gradient(180deg, #e2e8f0 0%, #ffffff 45%, #cbd5e1 100%);

      border-radius: 3px;

      border: 1.5px solid var(--accent-gold);

      box-shadow:

        inset 0 1.5px 3px rgba(0, 0, 0, 0.55),

        0 1px 2px rgba(255, 255, 255, 0.2);

      display: flex;

      align-items: center;

      justify-content: center;

      font-family: 'JetBrains Mono', monospace;

      font-weight: 600;

      font-size: clamp(10px, 2.5vw, 13px);

      color: #0f172a;

      letter-spacing: -0.02em;

      transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.4s ease;

    }


    .date-aperture.pos-bottom {

      top: auto;

      bottom: 18.5%;

      right: 50%;

      transform: translateX(50%);

    }


    .date-aperture.hidden {

      opacity: 0;

      pointer-events: none;

    }


    /* Digital Sub-Dial / GMT Readout */

    .gmt-window {

      position: absolute;

      bottom: 27.5%;

      left: 50%;

      transform: translateX(-50%);

      z-index: 4;

      padding: 2px 8px;

      border-radius: 4px;

      background: rgba(0, 0, 0, 0.32);

      border: 1px solid rgba(255, 255, 255, 0.12);

      font-family: 'JetBrains Mono', monospace;

      font-size: clamp(8.5px, 2vw, 10.5px);

      letter-spacing: 0.08em;

      color: var(--text-primary);

      backdrop-filter: blur(2px);

      transition: opacity 0.3s ease, color 0.4s ease;

      white-space: nowrap;

    }


    .gmt-window.hidden {

      opacity: 0;

      pointer-events: none;

    }


    /* Domed Sapphire Crystal Glare Overlay */

    .sapphire-crystal {

      position: absolute;

      inset: 0;

      border-radius: 50%;

      z-index: 10;

      pointer-events: none;

      background:

        linear-gradient(

          132deg,

          rgba(255, 255, 255, 0.22) 0%,

          rgba(255, 255, 255, 0.06) 28%,

          rgba(255, 255, 255, 0) 48%,

          rgba(255, 255, 255, 0) 82%,

          rgba(255, 255, 255, 0.08) 100%

        );

      box-shadow:

        inset 0 1px 2px rgba(255, 255, 255, 0.45),

        inset 0 -2px 6px rgba(0, 0, 0, 0.45);

    }


    /* Lume Night-Vision Glow Toggle */

    body.lume-mode {

      --bg-outer: #030406;

      --bg-inner: #070a0f;

    }


    body.lume-mode .watch-dial {

      filter: brightness(0.32) contrast(1.25);

    }


    body.lume-mode .lume-element {

      fill: var(--lume-color) !important;

      filter: drop-shadow(0 0 5px var(--lume-glow)) drop-shadow(0 0 10px var(--lume-glow));

    }


    /* Controls Bar */

    .controls-dock {

      display: flex;

      flex-wrap: wrap;

      align-items: center;

      justify-content: center;

      gap: 10px 14px;

      padding: 12px 18px;

      border-radius: 16px;

      background: var(--glass-panel);

      border: 1px solid var(--glass-border);

      backdrop-filter: blur(14px);

      -webkit-backdrop-filter: blur(14px);

      box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);

      max-width: 720px;

    }


    .control-group {

      display: flex;

      align-items: center;

      gap: 6px;

    }


    .divider {

      width: 1px;

      height: 20px;

      background: rgba(255, 255, 255, 0.12);

    }


    /* Theme Swatches */

    .swatch {

      width: 22px;

      height: 22px;

      border-radius: 50%;

      border: 2px solid rgba(255, 255, 255, 0.25);

      cursor: pointer;

      transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;

    }


    .swatch:hover {

      transform: scale(1.14);

    }


    .swatch.active {

      border-color: #ffffff;

      transform: scale(1.15);

      box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.65);

    }


    .swatch[data-set-theme="obsidian"] { background: radial-gradient(circle at 30% 30%, #2a3342, #090b10); }

    .swatch[data-set-theme="silver"]   { background: radial-gradient(circle at 30% 30%, #ffffff, #cbd5e1); }

    .swatch[data-set-theme="emerald"]  { background: radial-gradient(circle at 30% 30%, #10b981, #042f1e); }

    .swatch[data-set-theme="champagne"]{ background: radial-gradient(circle at 30% 30%, #f5ecd9, #bfa882); }

    .swatch[data-set-theme="marine"]   { background: radial-gradient(circle at 30% 30%, #2563eb, #071326); }


    /* Action Pills */

    .pill-btn {

      appearance: none;

      background: rgba(255, 255, 255, 0.06);

      border: 1px solid rgba(255, 255, 255, 0.12);

      color: #e2e8f0;

      font-family: 'Inter', sans-serif;

      font-size: 12px;

      font-weight: 500;

      padding: 6px 11px;

      border-radius: 999px;

      cursor: pointer;

      display: inline-flex;

      align-items: center;

      gap: 6px;

      transition: all 0.2s ease;

    }


    .pill-btn:hover {

      background: rgba(255, 255, 255, 0.13);

      border-color: rgba(255, 255, 255, 0.25);

    }


    .pill-btn.active {

      background: rgba(212, 175, 55, 0.2);

      border-color: rgba(212, 175, 55, 0.65);

      color: #fef08a;

    }


    .tz-select {

      appearance: none;

      background: rgba(255, 255, 255, 0.06);

      border: 1px solid rgba(255, 255, 255, 0.12);

      color: #e2e8f0;

      font-family: 'Inter', sans-serif;

      font-size: 12px;

      font-weight: 500;

      padding: 6px 26px 6px 11px;

      border-radius: 999px;

      cursor: pointer;

      outline: none;

      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

      background-repeat: no-repeat;

      background-position: right 9px center;

      transition: border-color 0.2s ease, background-color 0.2s ease;

    }


    .tz-select:hover {

      background-color: rgba(255, 255, 255, 0.12);

      border-color: rgba(255, 255, 255, 0.25);

    }


    .tz-select option {

      background: #11151c;

      color: #f8fafc;

    }


    @media (max-width: 540px) {

      .divider { display: none; }

      .controls-dock { padding: 10px 12px; gap: 8px; }

    }

  </style>

</head>

<body data-theme="obsidian">


  <main class="watch-stage" aria-label="Luxury Analog Watch">

    <!-- Lugs & Crown -->

    <div class="lugs" aria-hidden="true">

      <div class="lug-pair top">

        <div class="lug"></div>

        <div class="lug"></div>

      </div>

      <div class="lug-pair bottom">

        <div class="lug"></div>

        <div class="lug"></div>

      </div>

    </div>

    <div class="crown" aria-hidden="true"></div>


    <!-- Outer Steel Case -->

    <div class="watch-bezel">

      <div class="bezel-chamfer">

        <div class="watch-dial">

          <!-- Date Aperture -->

          <div id="dateAperture" class="date-aperture" title="Date Window">24</div>


          <!-- Optional Digital / Timezone Readout -->

          <div id="gmtWindow" class="gmt-window">LOCAL · 10:10:00</div>


          <!-- Precision SVG Dial & Hands -->

          <svg class="dial-svg" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">

            <defs>

              <!-- Metallic Gold / Steel Gradients for Hands & Indices -->

              <linearGradient id="metalLight" x1="0%" y1="0%" x2="100%" y2="0%">

                <stop offset="0%" stop-color="var(--accent-gold-light)" />

                <stop offset="50%" stop-color="var(--accent-gold)" />

                <stop offset="50.1%" stop-color="var(--accent-gold-dark)" />

                <stop offset="100%" stop-color="var(--accent-gold)" />

              </linearGradient>


              <linearGradient id="indexFacet" x1="0%" y1="0%" x2="100%" y2="100%">

                <stop offset="0%" stop-color="var(--accent-gold-light)" />

                <stop offset="48%" stop-color="var(--accent-gold)" />

                <stop offset="100%" stop-color="var(--accent-gold-dark)" />

              </linearGradient>


              <radialGradient id="capGrad" cx="35%" cy="35%" r="65%">

                <stop offset="0%" stop-color="#ffffff" />

                <stop offset="45%" stop-color="var(--accent-gold)" />

                <stop offset="100%" stop-color="var(--accent-gold-dark)" />

              </radialGradient>


              <!-- Soft Drop Shadow for Hands -->

              <filter id="handShadow" x="-30%" y="-30%" width="160%" height="160%">

                <feGaussianBlur in="SourceAlpha" stdDeviation="2.4" />

                <feOffset dx="0" dy="0" />

                <feComponentTransfer>

                  <feFuncA type="linear" slope="0.58" />

                </feComponentTransfer>

                <feMerge>

                  <feMergeNode />

                  <feMergeNode in="SourceGraphic" />

                </feMerge>

              </filter>

            </defs>


            <!-- Outer Chapter Ring & Minute/Sub-second Track -->

            <circle cx="200" cy="200" r="186" fill="none" stroke="var(--text-muted)" stroke-opacity="0.22" stroke-width="0.75" />

            <circle cx="200" cy="200" r="173" fill="none" stroke="var(--text-muted)" stroke-opacity="0.16" stroke-width="0.6" />


            <!-- Container for Procedural Ticks & Applied Indices -->

            <g id="dialMarkings"></g>


            <!-- Brand Crest & Horological Typography -->

            <g transform="translate(200, 114)">

              <!-- Crown Emblem -->

              <path d="M-8,2 L-11,-7 L-4,-2 L0,-10 L4,-2 L11,-7 L8,2 Z" fill="url(#indexFacet)" />

              <rect x="-8" y="3.5" width="16" height="1.8" rx="0.8" fill="url(#indexFacet)" />

              <text y="20" text-anchor="middle" font-size="13.5" class="brand-signature">GENÈVE</text>

              <text y="32" text-anchor="middle" font-size="6.4" class="brand-sub">AUTOMATIC</text>

            </g>


            <g transform="translate(200, 266)">

              <text y="0" text-anchor="middle" font-size="6.2" class="chronometer-cert">SUPERLATIVE CHRONOMETER</text>

              <text y="9.5" text-anchor="middle" font-size="5.6" class="chronometer-cert">OFFICIALLY CERTIFIED</text>

            </g>


            <!-- Swiss Made at 6 o'clock -->

            <text x="200" y="381" text-anchor="middle" font-size="5.5" letter-spacing="0.18em" fill="var(--text-muted)" opacity="0.8">SWISS MADE</text>


            <!-- Dynamic Hand Shadows Layer (Offset updated in JS based on light source) -->

            <g id="hourShadow" opacity="0.45" filter="url(#handShadow)">

              <polygon points="200,92 207.5,186 204,218 196,218 192.5,186" fill="#000000" />

            </g>

            <g id="minuteShadow" opacity="0.42" filter="url(#handShadow)">

              <polygon points="200,46 205.5,186 203,222 197,222 194.5,186" fill="#000000" />

            </g>

            <g id="secondShadow" opacity="0.38" filter="url(#handShadow)">

              <line x1="200" y1="242" x2="200" y2="38" stroke="#000000" stroke-width="1.8" />

              <circle cx="200" cy="232" r="4.5" fill="#000000" />

            </g>


            <!-- HOUR HAND (Faceted Dauphine with Super-LumiNova Inlay) -->

            <g id="hourHand">

              <polygon points="200,92 207.5,186 204,218 196,218 192.5,186" fill="url(#metalLight)" stroke="rgba(0,0,0,0.35)" stroke-width="0.5" />

              <!-- Center Ridge -->

              <line x1="200" y1="92" x2="200" y2="218" stroke="rgba(255,255,255,0.45)" stroke-width="0.6" />

              <!-- Lume Strip -->

              <polygon class="lume-element" points="200,108 202.4,178 197.6,178" fill="#f8fafc" opacity="0.92" />

            </g>


            <!-- MINUTE HAND (Faceted Dauphine with Super-LumiNova Inlay) -->

            <g id="minuteHand">

              <polygon points="200,46 205.5,186 203,222 197,222 194.5,186" fill="url(#metalLight)" stroke="rgba(0,0,0,0.35)" stroke-width="0.5" />

              <!-- Center Ridge -->

              <line x1="200" y1="46" x2="200" y2="222" stroke="rgba(255,255,255,0.45)" stroke-width="0.6" />

              <!-- Lume Strip -->

              <polygon class="lume-element" points="200,62 201.8,176 198.2,176" fill="#f8fafc" opacity="0.92" />

            </g>


            <!-- SWEEP SECOND HAND (Counterweighted Needle with Lume Pip) -->

            <g id="secondHand">

              <!-- Counterweight Tail -->

              <polygon points="198.2,244 201.8,244 201,200 199,200" fill="var(--second-hand)" />

              <circle cx="200" cy="232" r="4.5" fill="var(--second-hand)" />

              <!-- Needle Shaft -->

              <polygon points="199.1,200 200.9,200 200.35,38 199.65,38" fill="var(--second-hand)" />

              <!-- Lume Lollipop Pip -->

              <circle cx="200" cy="76" r="3.4" fill="var(--second-hand)" />

              <circle class="lume-element" cx="200" cy="76" r="2.1" fill="#ffffff" />

            </g>


            <!-- Center Pinion Cap -->

            <circle cx="200" cy="200" r="7.5" fill="url(#capGrad)" stroke="rgba(0,0,0,0.4)" stroke-width="0.7" />

            <circle cx="200" cy="200" r="2.3" fill="#1e293b" opacity="0.65" />

          </svg>


          <!-- Domed Sapphire Crystal Reflection -->

          <div class="sapphire-crystal"></div>

        </div>

      </div>

    </div>

  </main>


  <!-- Minimalist Horological Controls -->

  <section class="controls-dock" aria-label="Timepiece Controls">

    <!-- Dial Colorway Swatches -->

    <div class="control-group" role="group" aria-label="Dial Finish">

      <button class="swatch active" data-set-theme="obsidian" title="Midnight Obsidian"></button>

      <button class="swatch" data-set-theme="silver" title="Classic Silver Sunburst"></button>

      <button class="swatch" data-set-theme="emerald" title="Emerald Forest"></button>

      <button class="swatch" data-set-theme="champagne" title="Warm Champagne"></button>

      <button class="swatch" data-set-theme="marine" title="Deep Marine Blue"></button>

    </div>


    <div class="divider"></div>


    <!-- Movement Mode (28,800 vph Mechanical Sweep vs 1Hz Quartz Tick) -->

    <button id="movementBtn" class="pill-btn active" title="Toggle Mechanical Sweep vs Quartz Tick">

      <span id="movementDot">●</span>

      <span id="movementLabel">28,800 vph Sweep</span>

    </button>


    <!-- Lume Night Mode -->

    <button id="lumeBtn" class="pill-btn" title="Toggle Super-LumiNova Night Glow">

      <span>✦ Lume</span>

    </button>


    <!-- Mechanical Ticking Sound -->

    <button id="soundBtn" class="pill-btn" title="Toggle Mechanical Escapement Sound">

      <span id="soundIcon">🔇</span>

      <span>Tick Audio</span>

    </button>


    <div class="divider"></div>


    <!-- Date & GMT Readout Toggle -->

    <button id="complicationBtn" class="pill-btn" title="Cycle Date & Digital Sub-Display">

      <span>Date: 3H</span>

    </button>


    <!-- World Timezone Selector -->

    <select id="timezoneSelect" class="tz-select" aria-label="Select Timezone">

      <option value="local">Local Time</option>

      <option value="Europe/Zurich">Geneva (CET)</option>

      <option value="America/New_York">New York (EST)</option>

      <option value="Europe/London">London (GMT)</option>

      <option value="Asia/Tokyo">Tokyo (JST)</option>

      <option value="Asia/Dubai">Dubai (GST)</option>

      <option value="UTC">UTC</option>

    </select>

  </section>


  <script>

    (function () {

      const SVG_NS = "http://www.w3.org/2000/svg";

      const markingsGroup = document.getElementById("dialMarkings");


      // 1. Build High-Precision Dial Tracks & Applied Baton Indices

      function buildDialGeometry() {

        const cx = 200, cy = 200;


        // 300 fine sub-second graduations (5 ticks per second, matching 28,800 vph / 4Hz beat)

        for (let i = 0; i < 300; i++) {

          const angle = (i * 360) / 300;

          const isSecond = i % 5 === 0;

          const isFiveMin = i % 25 === 0;


          const rOuter = 185;

          const rInner = isFiveMin ? 174 : isSecond ? 177 : 181;

          const strokeWidth = isFiveMin ? 1.5 : isSecond ? 0.95 : 0.45;

          const opacity = isFiveMin ? 0.92 : isSecond ? 0.78 : 0.35;


          const line = document.createElementNS(SVG_NS, "line");

          line.setAttribute("x1", cx);

          line.setAttribute("y1", cy - rOuter);

          line.setAttribute("x2", cx);

          line.setAttribute("y2", cy - rInner);

          line.setAttribute("stroke", "var(--text-primary)");

          line.setAttribute("stroke-width", strokeWidth);

          line.setAttribute("stroke-opacity", opacity);

          line.setAttribute("transform", `rotate(${angle} ${cx} ${cy})`);

          markingsGroup.appendChild(line);

        }


        // 12 Applied Metallic Hour Indices with Lume Plots

        for (let h = 0; h < 12; h++) {

          const angle = h * 30;

          const g = document.createElementNS(SVG_NS, "g");

          g.setAttribute("transform", `rotate(${angle} ${cx} ${cy})`);


          // Outer Lume Dot at Chapter Ring

          const lumeDot = document.createElementNS(SVG_NS, "circle");

          lumeDot.setAttribute("cx", cx);

          lumeDot.setAttribute("cy", 31);

          lumeDot.setAttribute("r", h % 3 === 0 ? "2.4" : "1.8");

          lumeDot.setAttribute("fill", "#f8fafc");

          lumeDot.setAttribute("class", "lume-element");

          g.appendChild(lumeDot);


          if (h === 0) {

            // Double Baton at 12 o'clock

            [-4.6, 4.6].forEach((offsetX) => {

              const baton = document.createElementNS(SVG_NS, "rect");

              baton.setAttribute("x", cx + offsetX - 2.6);

              baton.setAttribute("y", 39);

              baton.setAttribute("width", 5.2);

              baton.setAttribute("height", 26);

              baton.setAttribute("rx", 1.2);

              baton.setAttribute("fill", "url(#indexFacet)");

              baton.setAttribute("stroke", "rgba(0,0,0,0.35)");

              baton.setAttribute("stroke-width", "0.5");

              g.appendChild(baton);


              const inlay = document.createElementNS(SVG_NS, "rect");

              inlay.setAttribute("x", cx + offsetX - 1.1);

              inlay.setAttribute("y", 42);

              inlay.setAttribute("width", 2.2);

              inlay.setAttribute("height", 20);

              inlay.setAttribute("rx", 0.6);

              inlay.setAttribute("fill", "#ffffff");

              inlay.setAttribute("class", "lume-element");

              g.appendChild(inlay);

            });

          } else {

            // Single Faceted Baton Index (shortened at 3 o'clock for date aperture)

            const isThree = h === 3;

            const length = isThree ? 11 : 23;

            const baton = document.createElementNS(SVG_NS, "rect");

            baton.setAttribute("x", cx - 3);

            baton.setAttribute("y", 39);

            baton.setAttribute("width", 6);

            baton.setAttribute("height", length);

            baton.setAttribute("rx", 1.2);

            baton.setAttribute("fill", "url(#indexFacet)");

            baton.setAttribute("stroke", "rgba(0,0,0,0.35)");

            baton.setAttribute("stroke-width", "0.5");

            g.appendChild(baton);


            const inlay = document.createElementNS(SVG_NS, "rect");

            inlay.setAttribute("x", cx - 1.2);

            inlay.setAttribute("y", 42);

            inlay.setAttribute("width", 2.4);

            inlay.setAttribute("height", Math.max(5, length - 6));

            inlay.setAttribute("rx", 0.6);

            inlay.setAttribute("fill", "#ffffff");

            inlay.setAttribute("class", "lume-element");

            g.appendChild(inlay);

          }


          markingsGroup.appendChild(g);

        }

      }


      buildDialGeometry();


      // 2. State & Elements

      const hourHand = document.getElementById("hourHand");

      const minuteHand = document.getElementById("minuteHand");

      const secondHand = document.getElementById("secondHand");

      const hourShadow = document.getElementById("hourShadow");

      const minuteShadow = document.getElementById("minuteShadow");

      const secondShadow = document.getElementById("secondShadow");

      const dateAperture = document.getElementById("dateAperture");

      const gmtWindow = document.getElementById("gmtWindow");


      let isMechanicalSweep = true;

      let isSoundEnabled = false;

      let selectedTimezone = "local";

      let complicationMode = 0; // 0: Date 3H + GMT, 1: Date 6H + GMT, 2: Date 3H only, 3: Clean Dress Dial


      // 3. Web Audio API Mechanical Escapement Synthesizer

      let audioCtx = null;

      let lastBeatIndex = -1;


      function triggerEscapementTick(isAccent) {

        if (!isSoundEnabled) return;

        try {

          if (!audioCtx) {

            audioCtx = new (window.AudioContext || window.webkitAudioContext)();

          }

          if (audioCtx.state === "suspended") {

            audioCtx.resume();

          }


          const now = audioCtx.currentTime;

          const osc = audioCtx.createOscillator();

          const gain = audioCtx.createGain();

          const filter = audioCtx.createBiquadFilter();


          // Crisp metallic pallet-fork impulse

          osc.type = "triangle";

          osc.frequency.setValueAtTime(isAccent ? 2400 : 1950, now);

          osc.frequency.exponentialRampToValueAtTime(420, now + 0.018);


          filter.type = "bandpass";

          filter.frequency.value = 2100;

          filter.Q.value = 2.4;


          gain.gain.setValueAtTime(isAccent ? 0.055 : 0.032, now);

          gain.gain.exponentialRampToValueAtTime(0.0001, now + 0.022);


          osc.connect(filter);

          filter.connect(gain);

          gain.connect(audioCtx.destination);


          osc.start(now);

          osc.stop(now + 0.025);

        } catch (e) {

          // Ignore audio restrictions if blocked

        }

      }


      // 4. Timezone Extraction Helper

      function getZonedTimeParts(date, tz) {

        if (tz === "local") {

          return {

            hours: date.getHours(),

            minutes: date.getMinutes(),

            seconds: date.getSeconds(),

            ms: date.getMilliseconds(),

            day: date.getDate(),

            label: "LOCAL"

          };

        }


        const formatter = new Intl.DateTimeFormat("en-US", {

          timeZone: tz,

          hour12: false,

          hour: "2-digit",

          minute: "2-digit",

          second: "2-digit",

          day: "2-digit"

        });


        const parts = formatter.formatToParts(date);

        const map = {};

        parts.forEach((p) => (map[p.type] = p.value));


        const shortLabels = {

          "Europe/Zurich": "GVA",

          "America/New_York": "NYC",

          "Europe/London": "LDN",

          "Asia/Tokyo": "TYO",

          "Asia/Dubai": "DXB",

          "UTC": "UTC"

        };


        return {

          hours: parseInt(map.hour, 10) % 24,

          minutes: parseInt(map.minute, 10),

          seconds: parseInt(map.second, 10),

          ms: date.getMilliseconds(),

          day: parseInt(map.day, 10),

          label: shortLabels[tz] || "GMT"

        };

      }


      // 5. High-Precision Animation Loop

      function updateClock() {

        const now = new Date();

        const t = getZonedTimeParts(now, selectedTimezone);


        // Calculate continuous or stepped seconds

        let effectiveSeconds;

        if (isMechanicalSweep) {

          // 28,800 vibrations per hour = 8 beats per second

          const beat = Math.floor(t.ms / 125);

          effectiveSeconds = t.seconds + (beat * 125) / 1000;


          const globalBeat = t.seconds * 8 + beat;

          if (globalBeat !== lastBeatIndex) {

            lastBeatIndex = globalBeat;

            triggerEscapementTick(beat % 2 === 0);

          }

        } else {

          // 1 Hz Quartz Step

          effectiveSeconds = t.seconds;

          if (t.seconds !== lastBeatIndex) {

            lastBeatIndex = t.seconds;

            triggerEscapementTick(true);

          }

        }


        const smoothMinutes = t.minutes + effectiveSeconds / 60;

        const smoothHours = (t.hours % 12) + smoothMinutes / 60;


        const secDeg = effectiveSeconds * 6;

        const minDeg = smoothMinutes * 6;

        const hourDeg = smoothHours * 30;


        // Rotate Hands

        hourHand.setAttribute("transform", `rotate(${hourDeg} 200 200)`);

        minuteHand.setAttribute("transform", `rotate(${minDeg} 200 200)`);

        secondHand.setAttribute("transform", `rotate(${secDeg} 200 200)`);


        // Realistic Directional Drop Shadows (Light source from top-left 10:30 position)

        hourShadow.setAttribute("transform", `translate(3.2, 4.2) rotate(${hourDeg} 200 200)`);

        minuteShadow.setAttribute("transform", `translate(4.6, 5.8) rotate(${minDeg} 200 200)`);

        secondShadow.setAttribute("transform", `translate(6.0, 7.5) rotate(${secDeg} 200 200)`);


        // Update Date & Digital GMT Readout

        dateAperture.textContent = String(t.day).padStart(2, "0");


        const hh = String(t.hours).padStart(2, "0");

        const mm = String(t.minutes).padStart(2, "0");

        const ss = String(t.seconds).padStart(2, "0");

        gmtWindow.textContent = `${t.label} · ${hh}:${mm}:${ss}`;


        requestAnimationFrame(updateClock);

      }


      requestAnimationFrame(updateClock);


      // 6. Interactive UI Controls

      // Theme Switcher

      document.querySelectorAll(".swatch").forEach((btn) => {

        btn.addEventListener("click", () => {

          document.querySelectorAll(".swatch").forEach((s) => s.classList.remove("active"));

          btn.classList.add("active");

          document.body.setAttribute("data-theme", btn.dataset.setTheme);

        });

      });


      // Mechanical Sweep vs Quartz Tick

      const movementBtn = document.getElementById("movementBtn");

      const movementLabel = document.getElementById("movementLabel");

      movementBtn.addEventListener("click", () => {

        isMechanicalSweep = !isMechanicalSweep;

        movementBtn.classList.toggle("active", isMechanicalSweep);

        movementLabel.textContent = isMechanicalSweep ? "28,800 vph Sweep" : "1 Hz Quartz Tick";

      });


      // Super-LumiNova Night Mode

      const lumeBtn = document.getElementById("lumeBtn");

      lumeBtn.addEventListener("click", () => {

        const active = document.body.classList.toggle("lume-mode");

        lumeBtn.classList.toggle("active", active);

      });


      // Acoustic Escapement Toggle

      const soundBtn = document.getElementById("soundBtn");

      const soundIcon = document.getElementById("soundIcon");

      soundBtn.addEventListener("click", () => {

        isSoundEnabled = !isSoundEnabled;

        soundBtn.classList.toggle("active", isSoundEnabled);

        soundIcon.textContent = isSoundEnabled ? "🔊" : "🔇";

      });


      // Complication Layout Cycler

      const complicationBtn = document.getElementById("complicationBtn");

      const complicationLabels = [

        "Date: 3H + GMT",

        "Date: 6H + GMT",

        "Date: 3H Only",

        "Clean Dress Dial"

      ];

      complicationBtn.addEventListener("click", () => {

        complicationMode = (complicationMode + 1) % 4;

        complicationBtn.querySelector("span").textContent = complicationLabels[complicationMode];


        dateAperture.classList.remove("pos-bottom", "hidden");

        gmtWindow.classList.remove("hidden");


        if (complicationMode === 1) {

          dateAperture.classList.add("pos-bottom");

        } else if (complicationMode === 2) {

          gmtWindow.classList.add("hidden");

        } else if (complicationMode === 3) {

          dateAperture.classList.add("hidden");

          gmtWindow.classList.add("hidden");

        }

      });


      // Timezone Selector

      const timezoneSelect = document.getElementById("timezoneSelect");

      timezoneSelect.addEventListener("change", (e) => {

        selectedTimezone = e.target.value;

      });

    })();

  </script>

</body>

</html>

Click here to see watch preview

Post a Comment

Previous Post Next Post